From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83F3227FD76 for ; Tue, 18 Aug 2026 14:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787062885; cv=none; b=ZRYJizVPx2XvonhWYOprl7SZe4T2mBY1CvYN4EOmugSUJkj7h9aKOBF0G/VZ3o/inCeTg7BEzrT/gEVL2PNj8CmoQ8rDI+huRoxetm+knrxf/5twCh3WawnKfpT79OQMw9j9q6qCqvpvpi9tdlaYbkvFGplmOvjRKhDx6FwBAy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787062885; c=relaxed/simple; bh=yZGwmHaRJmyXvLX1gdMsuuDSA53hPS/5GebOpqWNNDk=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kY90/GblsgDIX1Bw43PSEKjjUJDFITS/VFPUrrGCIsz0INqC3xOBNHHz5KWGTTqdmvw7CBZmKv+m9ofY+LmkHoThqtjmIo8NrlltXmA43bckM1d0i6Q73CZsGPN2++U7zd2JRYbov5bCyrQBRBlMUTa81uuwcnJ6ASG1SJSvpiQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CTgqPzVG; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CTgqPzVG" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4994c49f588so12849635e9.0 for ; Tue, 18 Aug 2026 07:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787062882; x=1787667682; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=xh6sznIcTWQR5cHVojCsxyM98WEjQuypf/fmpziWKAg=; b=CTgqPzVGUuLDsYSBHiGuqYXHayL43PWB3zPkTA5UdIM7VnmSAZc/1NQPcGLseoEPtA qAJyqNC1Kcf096gGUb65j4h84NjwEeTTPR2RLFp4d1QpJtimCkx6Q3VM1KgQisCB0ABy +tIFZ6sZNVNrRO+8TOzND8p5LLvcFrF7OYWwb8beB6RuieUbeevsy5Zv9Rtrclpan6y/ gYsDf7Cq93+0cxrHTku+/n/fpkD2Qv2m+WCQGowF0GdPK4ty2+oxJtivdjFDhUba2gh8 YCWWowxPb5Xysf+umDlNxbDk1fCWUt/TWoq8xG9mo72a84dwm/rlsE91HARaBUx6hrDF /FRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787062882; x=1787667682; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=xh6sznIcTWQR5cHVojCsxyM98WEjQuypf/fmpziWKAg=; b=keSZDs5swdK5/hD9MHX6Vph/+T+HMNSvewuasmTImr0/qUVXiWvYmfIGTTRwVouhAC +JefcuY7LROBLBg7eLQNrbh0ddfana4ATqLyCp3BzJ9oWbqAtdGTCMRVyP+nN79183KP cLPOWrqGKvRcLIKB4LHSZJehH6k1YVft2aVJ5HRm3+KtgDu4tc1yX/omUQpWHXzNRss6 vEJLHv4vtW9DE4LpsYqYS2Hpg5X8sm9OGZ1IrRFKxnABceQu8zGPWF6Uxo2ODrXJ93Yg 8XvdSy54+g1UaWyna3ArEhdU4kbWYFyiWo/dwAyQXhCtzyfPEpydsGHXOqRSGl067SEp ma3w== X-Forwarded-Encrypted: i=1; AHgh+RpFJRgz4Dor78srgGkmNP9K22v2PArho/2WB6d/XY9+3Qj9gUb0DSShrgWSE+E22UM31wCjA7+ESZgN8tk=@vger.kernel.org X-Gm-Message-State: AOJu0YyftSA3SNqKi5k21H1BojUg/8K9ozv1ResaiHV7IObLZWpSGw0w oM8vtXfyS8Tii/78EeThKuQuSk/O+XoER9Gk4fKiWg6wXSqKmsiLdL0I X-Gm-Gg: AR+sD10j5oqJfIHOizVQpsFh0wQ6LXtxCb7tOv1pYpSvtfzvgkD784QQQRmgDtJMXvQ W0p9VOpuwYgeBSZ5xnxYHYzCEVq9w9+FqSE9sfUKUvTOmDGrB6UtmbUQaLPUWZatiKdFvQylrb4 SkyzKxuPUN4MyfUt2n6Ew+blHZCh0igUm2FDqs8G4CxRgOt7osswC12hdkVSS0kHfOIu9OjXtR/ 3cMvdvTkGph7Pr/h4taD7lg5Av973lkfVbHUdZdBespszTmhETNSfN55Su8YOjcWEPYkzGaMnlY S4JyB3++irGeBzPseOZGy66akgwDwYDKemRqxCZmOhrZ5LnSxZIga1XLCaDWaLelTR02QS5v7nR imN7l5BIFxbiqYK/imMC4aJXqw0WKnxAx2X0dFaqfC7rKvsvRzvyVIySqbIbLz+jo5pXjtLFfD8 vXVwvWaDVYvdKhqGuMfTB/5xM39F7iiInob5Bub4mQd8eP3rET9CNl0eFggxLWKWCv9V21S51ns DbV/1zMS/H1t4sBYLOew3VjUQ== X-Received: by 2002:a05:600c:858e:b0:499:5f81:8ca1 with SMTP id 5b1f17b1804b1-499a08d2c5fmr119294355e9.6.1787062881505; Tue, 18 Aug 2026 07:21:21 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5b81715sm12428769f8f.35.2026.08.18.07.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 07:21:20 -0700 (PDT) Date: Tue, 18 Aug 2026 15:21:13 +0100 From: David Laight To: Alex Deucher Cc: Amin Gattout , Alex Deucher , Christian =?UTF-8?B?S8O2bmln?= , David Airlie , Simona Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/amdgpu: Replace deprecated strcpy with strscpy Message-ID: <20260818152113.31b72e30@pumpkin> In-Reply-To: References: <20260818-amdgpu-strcpy-v1-1-3ee9b111fafe@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 18 Aug 2026 09:01:43 -0400 Alex Deucher wrote: > Applied. Thanks! >=20 > On Tue, Aug 18, 2026 at 7:10=E2=80=AFAM Amin Gattout wrote: > > > > strcpy() has been deprecated because it performs no bounds checking > > on the destination buffer, which can lead to buffer overflows. Replace > > it with the safer strscpy(). No functional changes. > > > > Signed-off-by: Amin Gattout > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c b/drivers/gpu/drm/= amd/amdgpu/amdgpu_mca.c > > index cc6d1a4e4c3a..1caa393c44d5 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c > > @@ -97,7 +97,7 @@ int amdgpu_mca_mp0_ras_sw_init(struct amdgpu_device *= adev) > > return err; > > } > > > > - strcpy(ras->ras_block.ras_comm.name, "mca.mp0"); > > + strscpy(ras->ras_block.ras_comm.name, "mca.mp0"); I missed this being proposed. Both strcpy() and strscpy() get converted to the same memcpy() (which might itself get converted to writing a 64bit constant). But if the string were too long strcpy() would generate a compile error whereas strscpy() just trunctates the string. Which one is better? David > > ras->ras_block.ras_comm.block =3D AMDGPU_RAS_BLOCK__MCA; > > ras->ras_block.ras_comm.sub_block_index =3D AMDGPU_RAS_MCA_BLOC= K__MP0; > > ras->ras_block.ras_comm.type =3D AMDGPU_RAS_ERROR__MULTI_UNCORR= ECTABLE; > > @@ -122,7 +122,7 @@ int amdgpu_mca_mp1_ras_sw_init(struct amdgpu_device= *adev) > > return err; > > } > > > > - strcpy(ras->ras_block.ras_comm.name, "mca.mp1"); > > + strscpy(ras->ras_block.ras_comm.name, "mca.mp1"); > > ras->ras_block.ras_comm.block =3D AMDGPU_RAS_BLOCK__MCA; > > ras->ras_block.ras_comm.sub_block_index =3D AMDGPU_RAS_MCA_BLOC= K__MP1; > > ras->ras_block.ras_comm.type =3D AMDGPU_RAS_ERROR__MULTI_UNCORR= ECTABLE; > > @@ -147,7 +147,7 @@ int amdgpu_mca_mpio_ras_sw_init(struct amdgpu_devic= e *adev) > > return err; > > } > > > > - strcpy(ras->ras_block.ras_comm.name, "mca.mpio"); > > + strscpy(ras->ras_block.ras_comm.name, "mca.mpio"); > > ras->ras_block.ras_comm.block =3D AMDGPU_RAS_BLOCK__MCA; > > ras->ras_block.ras_comm.sub_block_index =3D AMDGPU_RAS_MCA_BLOC= K__MPIO; > > ras->ras_block.ras_comm.type =3D AMDGPU_RAS_ERROR__MULTI_UNCORR= ECTABLE; > > > > --- > > base-commit: 0f23d56f17fdfc7db69d51f64c8b91bbab947aa9 > > change-id: 20260818-amdgpu-strcpy-0e92d18299c6 > > > > Best regards, > > -- > > Amin Gattout > > =20 >=20