From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (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 79AB1226D18 for ; Tue, 18 Aug 2026 17:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.221.172 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787074781; cv=pass; b=CcNIq4Icbysi8EFz7tC/K8ApDrRCrGo+i6nW2SHFht4Kj0hX0sUccH/hGpS4OfSst5Zwnwb6aAEvJP3wFU981uH1KaoXZ2K/VNYA4fQmsfDEHOTD7SUvYobAA6SQjXjrkCcuvfjjBAkVAaREfdmF5s0GgSJuOC0alYOyZfOiMRA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787074781; c=relaxed/simple; bh=5LXNESRLPfG/EykHplneeglxb3OxXqe/+CPMAsWZqbg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cwV86rs5JCuJ4WUB2wOekaN6SzzNKP6p79HFsZ+2zWdhKO8sPma3MIIOGKagmvPwXOOB8vbPLjO6M7Zlc/SR3HHPCbZUv15oyuRbrOs8cP7UhQEo+gAkZB6s4hhKLkvA9iW/3hIFgTgrpgHUFbPhae48FSKsbBFEgYCbqhwqHz0= ARC-Authentication-Results:i=2; 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=XCRhdnbR; arc=pass smtp.client-ip=209.85.221.172 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="XCRhdnbR" Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-5bfa1e7e123so5117e0c.1 for ; Tue, 18 Aug 2026 10:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1787074779; cv=none; d=google.com; s=arc-20260327; b=M0tgM7lF737L9DPd+zJfypP4kNaxeC8B0gHdfGLdRIXkJOWR4f3xi9vJLBCc1N8hRx HXrse2OHR6ep2cx4omommJJkmiEZ04V9TWjW8Ou/0QMTRQqlhCw5xUvHJCbBRGCiJo2q TpLgFZuV3R/RMbx56v5TExW1Zw9XHJwdw0qXx34mcuYOypgkeMBU2Kd/6hZWn878Nllt GEbghM/8ufQvp8zMvJ49s9xiyPjoQIPVh1qGewseVpS6a8lMec1gYtjc4hHE7b3R56di 3onfCLYA2u4volzs7p+6rzPP/L+0qMXWXMtw1TZJC18/3d3GXmDKJu/MZrKbWf2+d42d jOiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eEckY2/FWef46lUE2RU5Sdg+eCXq1PHhVlFbUmRSmPA=; fh=U0VQvHK+vglJdiYbOF2mEcdXvO2anq0P+VbDZNYv7yo=; b=pZRKH6vQq9MeBnS5SfKXPAcEGzJLvhWO4+gnRrzY7+1l2vqEjGpqUNTantq8WlmSso +2Pri0cRHHB7g5DfIYHQWKjuGaJ1nLuXZOJ794kxcUIjQRn2PQ6jAsvMw3MJ9+RLnmBP 8/VuzSPX0RwA2UKYVzLE84BANiokUsqB7/yT0ejjfbDBuIKpFAssRPAP8+g28PcuEkuw pGp4jbXfcZ3CFVLKiOgDWjaiKiCo30SRiCrspM7A4Pc8y7x3WEDOg+8CWTElol4W+cjG 3hRFHB2yMkzrN+9pG77ozK9CCbhoI2g1hl49Ftwa/7YvuBZ6E/8aBbL+49clU/saxesK y1bw==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787074779; x=1787679579; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=eEckY2/FWef46lUE2RU5Sdg+eCXq1PHhVlFbUmRSmPA=; b=XCRhdnbR+eKz5j/0fRtkxQ67NCPUWx1JBkSvKucqT4deQhQvhNURt/LiD1NhYKq77E Bt3zkawBhyWX7xhGQgpM+AbYz48y5+OGBhMEmfQbS15xkKX8NA1blCvPwCsYj0F4vFAs 7OpKpCZHjht7y90x6oQRMwwA45970uj0XAXnIPEHH/BbXYZEHiV6GpmcPhAmKSIvJ2bR XhiexTX9L51bMuN5zozpFZ/aShZfHafVhRgoB10ezUARGABb9+PdX7p89bwqS+na9UDJ oW1ZuhFaQvmMy/M7BBEq9ExgHHtcTbrsyUH8S/iXvZ5R5goovbY2NfqI2v37h5g5fYd9 g9fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787074779; x=1787679579; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=eEckY2/FWef46lUE2RU5Sdg+eCXq1PHhVlFbUmRSmPA=; b=kmr/7irXi+4AexjkdM4qZS2sx3ATB32m2PYQHKe/zFpPHAUWZ9fhdNIeBh3QMHEi5a DBnhpNf7iH2QMA08g5/+7RFVSxHVrEE4eW468g97QxTXvAKxKv1iNcCrUP6c7IIBMxys DhXYl00TTPQhX0pEPcqIu9tct3GwJYbuZL/mXdpvPrInWJyBO8iqhq5mbWId1R7Vp2iR k7QPkjG4RLS31SN9giaJ7vPV/0mIyQIuoaC2IoQC5rDwqpxI5nosHu8po+M0Fc1KR4gz 9WXR/KV5qi62N9l2AIriKssMHO4b7IOnc7oo195IJnmhrjObcJZX5a9ltjMcB+pfjaRa 4rJw== X-Forwarded-Encrypted: i=1; AHgh+Rofgj3Ik8RA5P/lCmvrecBM2Oi53fYwIT52U+TbF1H5tKXwBcpDDcQWhjeed2nhlQylhW68KJyA1EC3LfQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzoqPE7seopYwtnh3zZiZQtbP8gdsXZ3TcPviRJXtMof0ImjAFj EQdOwYIzo8HuuEgN6CM4QI96JEgnighNWBNPpW9F+i85qgBIvg/zVE7l3biGf4hJ7EtRhosOUVS EAgbeFyXxpPra3RRoIux6B55cdrB6tQo= X-Gm-Gg: AR+sD12pUhT2kSNxzHv2OrbYA6UiS/zo754HB+0RzTjj+uvzbNUEMEahSucxOdjKuCm bWjPbK0LMEuUs17kEyUZlx2pWYlRc5KIxyEJDMfyVmv6pcVQL0gSbg/GFG7yAbLYAt26bgP0F2w 7GUttuQgyZTx9f+4rHqxrPuJrixv6b4aHV15Hxb04r5isyXjfK4aFzAsyNkCHOXtik7zvr0m/2P kNYJO1SoBzDDs6jwJxCQZqIaGL/OsbX4V3QOt4tIkrWfc4im5a1luS5d2H9P2OKm+42jSeDJUPe FTTusWxMamZod1PplehkXi5HfWvojTPEw3IShxQJ6Jn1lNgkK9RnUUzO4I8N2J0s7HMqVHvq75S wiTPpv0oRjd2bSYt/jmGbyJIN6VuE5qI= X-Received: by 2002:a05:6122:6d03:b0:5bd:ae1c:afcf with SMTP id 71dfb90a1353d-5c591f935b9mr3387342e0c.3.1787074779223; Tue, 18 Aug 2026 10:39:39 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260818-amdgpu-strcpy-v1-1-3ee9b111fafe@gmail.com> <20260818152113.31b72e30@pumpkin> In-Reply-To: <20260818152113.31b72e30@pumpkin> From: Alex Deucher Date: Tue, 18 Aug 2026 13:39:26 -0400 X-Gm-Features: AcwNN1UdAawiuNlezTn1mx5MGXf0fGYUPgu4-splMDm1iIm25D8BbUfMfTsnfsM Message-ID: Subject: Re: [PATCH] drm/amdgpu: Replace deprecated strcpy with strscpy To: David Laight Cc: Amin Gattout , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Aug 18, 2026 at 10:21=E2=80=AFAM David Laight wrote: > > On Tue, 18 Aug 2026 09:01:43 -0400 > Alex Deucher wrote: > > > Applied. Thanks! > > > > 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. Replac= e > > > 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/dr= m/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? I don't know. I can go either way on this. Alex > > David > > > > ras->ras_block.ras_comm.block =3D AMDGPU_RAS_BLOCK__MCA; > > > ras->ras_block.ras_comm.sub_block_index =3D AMDGPU_RAS_MCA_BL= OCK__MP0; > > > ras->ras_block.ras_comm.type =3D AMDGPU_RAS_ERROR__MULTI_UNCO= RRECTABLE; > > > @@ -122,7 +122,7 @@ int amdgpu_mca_mp1_ras_sw_init(struct amdgpu_devi= ce *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_BL= OCK__MP1; > > > ras->ras_block.ras_comm.type =3D AMDGPU_RAS_ERROR__MULTI_UNCO= RRECTABLE; > > > @@ -147,7 +147,7 @@ int amdgpu_mca_mpio_ras_sw_init(struct amdgpu_dev= ice *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_BL= OCK__MPIO; > > > ras->ras_block.ras_comm.type =3D AMDGPU_RAS_ERROR__MULTI_UNCO= RRECTABLE; > > > > > > --- > > > base-commit: 0f23d56f17fdfc7db69d51f64c8b91bbab947aa9 > > > change-id: 20260818-amdgpu-strcpy-0e92d18299c6 > > > > > > Best regards, > > > -- > > > Amin Gattout > > > > > >