public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: "Jens Axboe" <axboe@kernel.dk>,
	"Stefan Haberland" <sth@linux.ibm.com>,
	"Jan Höppner" <hoeppner@linux.ibm.com>,
	"Peter Oberparleiter" <oberpar@linux.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-block@vger.kernel.org, nathan@kernel.org,
	llvm@lists.linux.dev, "David Laight" <David.Laight@aculab.com>
Subject: Re: [PATCH 1/1] s390/dasd: fix string length handling
Date: Mon, 28 Aug 2023 15:46:52 -0700	[thread overview]
Message-ID: <ZO0j3M8KFWeEznXy@google.com> (raw)
In-Reply-To: <20230828153142.2843753-2-hca@linux.ibm.com>

On Mon, Aug 28, 2023 at 05:31:42PM +0200, Heiko Carstens wrote:
> Building dasd_eckd.o with latest clang reveals this bug:
> 
>     CC      drivers/s390/block/dasd_eckd.o
>       drivers/s390/block/dasd_eckd.c:1082:3: warning: 'snprintf' will always be truncated;
>       specified size is 1, but format string expands to at least 11 [-Wfortify-source]
>        1082 |                 snprintf(print_uid, sizeof(*print_uid),
>             |                 ^
>       drivers/s390/block/dasd_eckd.c:1087:3: warning: 'snprintf' will always be truncated;
>       specified size is 1, but format string expands to at least 10 [-Wfortify-source]
>        1087 |                 snprintf(print_uid, sizeof(*print_uid),
>             |                 ^
> 
> Fix this by moving and using the existing UID_STRLEN for the arrays
> that are being written to. Also rename UID_STRLEN to DASD_UID_STRLEN
> to clarify its scope.
> 
> Fixes: 23596961b437 ("s390/dasd: split up dasd_eckd_read_conf")
> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Thanks for the patch! Nathan just reported a bunch of these. I took a
look at these two and thought "yeah that's clearly a bug in the kernel
sources." Fix LGTM.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Closes: https://github.com/ClangBuiltLinux/linux/issues/1923
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

I also like David's idea of passing `char ident [DASD_UID_STRLEN]`, too,
but I don't feel strongly either way.

       reply	other threads:[~2023-08-28 22:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230828153142.2843753-1-hca@linux.ibm.com>
     [not found] ` <20230828153142.2843753-2-hca@linux.ibm.com>
2023-08-28 22:46   ` Nick Desaulniers [this message]
2023-08-28 22:53     ` [PATCH 1/1] s390/dasd: fix string length handling Nick Desaulniers
2023-08-29  8:02     ` Heiko Carstens
2023-08-29 15:41       ` Nick Desaulniers
     [not found]   ` <f0419f6428ad404386ebca813dc1ec03@AcuMS.aculab.com>
2023-08-28 22:51     ` Nick Desaulniers
2023-08-29  7:48       ` Heiko Carstens
2023-08-29  8:32         ` David Laight
2023-08-29 15:39           ` Nick Desaulniers
2023-08-29 15:42         ` Nick Desaulniers

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=ZO0j3M8KFWeEznXy@google.com \
    --to=ndesaulniers@google.com \
    --cc=David.Laight@aculab.com \
    --cc=axboe@kernel.dk \
    --cc=hca@linux.ibm.com \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=oberpar@linux.ibm.com \
    --cc=sth@linux.ibm.com \
    /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