Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1356219lqt; Wed, 20 Mar 2024 00:56:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOVog++ChEAv06rm0ZDqNeSp2zEoF5paE8mICUvG6wXIVBU3z5jXl1efqNHujnx4/HRu/x1Mgls2YB09onEkyQjU5ca54y1tlvqyQ5Kg== X-Google-Smtp-Source: AGHT+IGEuW437ojblIDi5Ze8seFDdzKwFh55mnuNtLrG4o32B2Vb8HGFXh6Kx/jGDDQ3RN1WvSp0 X-Received: by 2002:a0c:c489:0:b0:691:82ed:396f with SMTP id u9-20020a0cc489000000b0069182ed396fmr12928492qvi.42.1710921400798; Wed, 20 Mar 2024 00:56:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710921400; cv=pass; d=google.com; s=arc-20160816; b=F8tHlJuAA+wHaUwN53HkFM8WjK08B24k7pWoZtEH0wxJ77xW2P5M9Xhq4A2M13L6pW r6IIYA0EuEZnXpFJjtl3zGbU8TXYvsbYkRFJuSm89u9RWicfjSO6oII8C2Dz/V60wX6S mKL/GJdWZwObaMWu2G1+vYUxcni8ZANimGp0YYLd/S9yX1BLCvamjkkclJvbPbarTpxO WxEdfr/n0z++Gp7F8hWDf4PI7FlfEXXiedZf0AMjmqZCxNoi238bBt8LyNfSBxZWmXzv CARVMYQJdqG3pm7UpmJVrhRtz69ncI8wqzQyeexFCr/kwsUno60B+XHvmB+ygcfZSUCJ 9JGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=uvNvLuBszXgVYXZdSwPN8AD8tI3aDeN137XHcSipi7k=; fh=jtzSUIHe9I/aXr0EXcQmPFaAa6979gd3Bz962lis+WM=; b=lHwOaSiKELSrsQIZNPcRHqFim2bIqXog3RPQPj7fJMQ5WhIXyEjrD9zgbkZ1Ti6q/x zkiauUCv45/FY1ZPi7qYOpORQvemoL6LmdKN2Bm4F5EReG4aBFGLZpZii5UfX7gHCcBE 1JChvI/Fpr6q3NpF+o4wqxhLtH7CKGI4GwFxqe3zzGMWTNAuk4xrMkEfNxH7X97EdLjQ 6pAlJ4z+YLdogLBkF8+GDspTSIRAVbpM90oCkeL9gqcoXrOCXFirNkMxMdMU8z+466re +4gZXzDj3fkKu7UkHndWNT1OF4Txydn7SXDXlVGk81GzaGRDCO+MubBX594T6zefPcFA ouvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=dGTNLMij; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-108577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108577-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u10-20020ad45aaa000000b00690b07d1fe6si12922346qvg.282.2024.03.20.00.56.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 00:56:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=dGTNLMij; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-108577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108577-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 70DBB1C2238B for ; Wed, 20 Mar 2024 07:56:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F10A2C698; Wed, 20 Mar 2024 07:56:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=deller@gmx.de header.b="dGTNLMij" Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 807292BB19; Wed, 20 Mar 2024 07:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921392; cv=none; b=A8IqYTjbEd/0iETMDyp5upD4ICaMlrC349YM3BKH0oyae6D+E9PedCZ4Z7En/DkyD/WgruhgipDldF4Cf1dQ5dWgFKS4R8PjPtiy9xCg6iFLmYosj9XuGqC5GJlkV+geh2MEj6bmcg9agcBWF8Xg5ZWpVKOukMOAqTitmZKYeuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921392; c=relaxed/simple; bh=CH3vWWYWC1I+cdZBrNQ6agk8eeoxsdROQ90+TZWo7LE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jtfv21cwbSNH0a+2VywBhAS0s4HunV1ZJ1i9qDQglw8ZKZlgaBWGRWRWMEM6UZA2BdwQByWUQOuc0dMfbhPC+rv2r09qR0FQacCRSBf2tbt5lB1+V8bvU7M6LjsbHE0mgHnD5oUYw1Gwfe1KCr9+yMr23JkI/Mj3cLoOkoy/QkU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=deller@gmx.de header.b=dGTNLMij; arc=none smtp.client-ip=212.227.15.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1710921382; x=1711526182; i=deller@gmx.de; bh=uvNvLuBszXgVYXZdSwPN8AD8tI3aDeN137XHcSipi7k=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=dGTNLMijWBCSnsnpKyu9jeH4t26aIHEqWZKWWz1Q5JjQVClXVKM8FOAECKL/S/63 bOZ+ge2GuW8KuWyMbTG6K1Hg5uBOnspl4myc0wjtbp75swaN/C3hJJr3YsYiKFsXN zAcu7xOJwbY+W4ld31MmUlfU21B+lZMw9835g+yaxRd1Srf3fy2ldzZ1B62xdRpGz xWGjNLgxJfM6tXSzrJN1ZDlWSqKbv40zWpVT9ttSC44EqEDi7+C3Dc1jWPQLJ39Rz vHj+sJei3DVCjPrhskStU3oMgDs44vVfkGcenI6FahB2tMUwwqEyzy/thcFKTow6L rf+m7563E2IN4ohSzg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.20.55] ([94.134.145.175]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MNKhs-1rOA1c0WaY-00OmMw; Wed, 20 Mar 2024 08:56:22 +0100 Message-ID: <53670007-edbc-4762-9e57-0b3c29220d9e@gmx.de> Date: Wed, 20 Mar 2024 08:56:21 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] video: fbdev: au1200fb: replace deprecated strncpy with strscpy Content-Language: en-US To: Justin Stitt Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Kees Cook References: <20240318-strncpy-drivers-video-fbdev-au1200fb-c-v1-1-680802a9f10a@google.com> From: Helge Deller Autocrypt: addr=deller@gmx.de; keydata= xsFNBF3Ia3MBEAD3nmWzMgQByYAWnb9cNqspnkb2GLVKzhoH2QD4eRpyDLA/3smlClbeKkWT HLnjgkbPFDmcmCz5V0Wv1mKYRClAHPCIBIJgyICqqUZo2qGmKstUx3pFAiztlXBANpRECgwJ r+8w6mkccOM9GhoPU0vMaD/UVJcJQzvrxVHO8EHS36aUkjKd6cOpdVbCt3qx8cEhCmaFEO6u CL+k5AZQoABbFQEBocZE1/lSYzaHkcHrjn4cQjc3CffXnUVYwlo8EYOtAHgMDC39s9a7S90L 69l6G73lYBD/Br5lnDPlG6dKfGFZZpQ1h8/x+Qz366Ojfq9MuuRJg7ZQpe6foiOtqwKym/zV dVvSdOOc5sHSpfwu5+BVAAyBd6hw4NddlAQUjHSRs3zJ9OfrEx2d3mIfXZ7+pMhZ7qX0Axlq Lq+B5cfLpzkPAgKn11tfXFxP+hcPHIts0bnDz4EEp+HraW+oRCH2m57Y9zhcJTOJaLw4YpTY GRUlF076vZ2Hz/xMEvIJddRGId7UXZgH9a32NDf+BUjWEZvFt1wFSW1r7zb7oGCwZMy2LI/G aHQv/N0NeFMd28z+deyxd0k1CGefHJuJcOJDVtcE1rGQ43aDhWSpXvXKDj42vFD2We6uIo9D 1VNre2+uAxFzqqf026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FwRDcGV6nxanxZGKEkSHHOm8jHwvQWvPP73pvuPBEPtKGLzbgd7OOcGZWtq2hNC6cRtsRdDx 4TAGMCz4j238m+2mdbdhRh3iBnWT5yPFfnv/2IjFAk+sdix1Mrr+LIDF++kiekeq0yUpDdc4 ExBy2xf6dd+tuFFBp3/VDN4U0UfG4QJ2fg19zE5Z8dS4jGIbLg== In-Reply-To: <20240318-strncpy-drivers-video-fbdev-au1200fb-c-v1-1-680802a9f10a@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:KVcYXRTYi2Yl5N9QohZQn/e0yOrgjT69zc3Q76tdh+qsSd+Y//N rBBJAWMM7rwJUzE3exqHGaxYi/aFQRZi4pws9yNsVwMzyt6spfwMjDvzniE7mUR39LexH2s LZ9GviBWFVbgL4lB/psgfP58G8YRR3IXjZ1nGQhyGukK0goqDFzrEkvRCi2kUAvHzKhARV1 sqi6/2eLCK3f0FPOOwvqA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:icEX6fWXWvo=;z2Bz9nQdvbUGV/r49J5VgTvdJ38 3dc52GR2rrmGYRXBG6b1E0EEM7X6Jq03onspRoFdX2TJZKZ19XDSq6kUTWMYRT8ndpN97qaRw P76jvans/XJ9ZQrHteLT8dGfzeIuoRN4c/t1OGgrQzODoNsnrjBq3k5huJJy6aN/OvZPbMnle Cb4gm3Z4E+i3iF9BGmvsi9uIzxuwQ12rZmq1ZXZO64/gD04X9ykkmFib6ThqcHoPFTP8iVkrg kW0svK3y6kCnJrLjSPUew3RwxrtZ/5grrQiNN/SUnwItQ7e59V1XM6cXGlyXoYePaUnpMdcF5 /KzysVx9oYuVjcgOuD0XJ07QwS+vHUy/BmeDmrGrGuDuychPuXwqUQBT/3qxssIuAraYilXUv ZGI3zGPKv4ppRnVl4/STTAQ6dcvHV6WvaymYWrfhiXggmNNjVZW2iFJnWEyfjSqPNrMNGcIfw y8idPwOJlpIviD+4Hzsvi9qFMm8GDVrgw4PZK7cdiboPTW7A8Ibl4G2ic0bPXiy1EiG5r3wGl +O7xtwY8xPnpeL4EAAtLKDdAKqc3YelTkyZU8EsolrofMSYfOCqU/o088lhkmApg+Sq1yRsGQ F42047QvvoAox3UaYkiOxMR/yA6ryX6ENDcFx7/ghizBzLHpFaV8BVFwBEh+pNsemgu6Xiw9g Z22haWTtuApmH6PKgbJz5ZHJT0jjGI3Y/AXX98rZFcM82vxi4vAOILSHpK9nHJpjAIl0q8Vqn fxf3ooZ/e+ga90d4Eubk8PF7GgGX958/FSGEeWnK6WBMOlpTzVtAkXBsJ3H29BBYdGqNWpXSm luLTw+BTXcv9C5ztxNAhRrL0bm2WgO98hbPnv6MI0WrL4= On 3/19/24 00:46, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > Let's use the new 2-argument strscpy() which guarantees NUL-termination > on the destination buffer while also simplifying the syntax. Note that > strscpy() will not NUL-pad the destination buffer like strncpy() does. > > However, the NUL-padding behavior of strncpy() is not required since > fbdev is already NUL-allocated from au1200fb_drv_probe() -> > frameuffer_alloc(), rendering any additional NUL-padding redundant. > | p =3D kzalloc(fb_info_size + size, GFP_KERNEL); > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#str= ncpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.= html [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt > --- > Note: build-tested only. > > Found with: $ rg "strncpy\(" > --- > drivers/video/fbdev/au1200fb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200= fb.c > index 6f20efc663d7..e718fea63662 100644 > --- a/drivers/video/fbdev/au1200fb.c > +++ b/drivers/video/fbdev/au1200fb.c > @@ -1557,7 +1557,7 @@ static int au1200fb_init_fbinfo(struct au1200fb_de= vice *fbdev) > return ret; > } > > - strncpy(fbi->fix.id, "AU1200", sizeof(fbi->fix.id)); > + strscpy(fbi->fix.id, "AU1200"); I wonder if you really build-tested this, as this driver is for the mips a= rchitecture... And I don't see a strscpy() function which takes just 2 arguments. But I might be wrong.... Helge