[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2b7d9a97-e180-4bcd-bc75-bde09a6d2157@moroto.mountain>
Date: Wed, 13 Mar 2024 20:56:51 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Florian Fainelli <florian.fainelli@...adcom.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: vc04_services: changen strncpy() to
strscpy_pad()
On Wed, Mar 13, 2024 at 05:36:56PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> gcc-14 warns about this strncpy() that results in a non-terminated
> string for an overflow:
>
> In file included from include/linux/string.h:369,
> from drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:20:
> In function 'strncpy',
> inlined from 'create_component' at drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:940:2:
> include/linux/fortify-string.h:108:33: error: '__builtin_strncpy' specified bound 128 equals destination size [-Werror=stringop-truncation]
>
> Change it to strscpy_pad(), which produces a properly terminated and
> zero-padded string.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
Thanks, Arnd!
Reviewed-by: Dan Carpenter <dan.carpenter@...aro.org>
(Greg is on vacation so I'm playing Greg for two weeks).
In real life, 128 is way larger than necessary so it's not an issue,
which is presumably why you left off the Fixes tag. Anyway, it's always
good to replace another strncpy().
I see another bug here where m.u.component_create.pid is never
initialized. I'll send a "m.u.component_create.pid = 0;" fix for that
based on top of your patch.
regards,
dan carpenter
Powered by blists - more mailing lists