Linux kernel staging patches
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: vc04_services: changen strncpy() to strscpy_pad()
Date: Wed, 13 Mar 2024 20:56:51 +0300	[thread overview]
Message-ID: <2b7d9a97-e180-4bcd-bc75-bde09a6d2157@moroto.mountain> (raw)
In-Reply-To: <20240313163712.224585-1-arnd@kernel.org>

On Wed, Mar 13, 2024 at 05:36:56PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.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@arndb.de>
> ---

Thanks, Arnd!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.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


      reply	other threads:[~2024-03-13 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 16:36 [PATCH] staging: vc04_services: changen strncpy() to strscpy_pad() Arnd Bergmann
2024-03-13 17:56 ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b7d9a97-e180-4bcd-bc75-bde09a6d2157@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).