mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Hannes Reinecke <hare@kernel.org>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Nathan Chancellor <nathan@kernel.org>
Cc: Tom Rix <trix@redhat.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, Nick Desaulniers <ndesaulniers@google.com>
Subject: [PATCH 0/2] scsi: fix 2 cases of -Wfortify-source
Date: Mon, 28 Aug 2023 15:25:46 -0700	[thread overview]
Message-ID: <20230828-scsi_fortify-v1-0-8dde624a3b2c@google.com> (raw)

clang-18 has improved its support for detecting operations that will
truncate values at runtime via -wfortify-source resulting in two new
warnings (or errors with CONFIG_WERROR=y):

  drivers/scsi/myrb.c:1906:10: warning: 'snprintf' will always be
  truncated; specified size is 32, but format string expands to at least
  34 [-Wfortify-source]

  drivers/scsi/myrs.c:1089:10: warning: 'snprintf' will always be
  truncated; specified size is 32, but format string expands to at least
  34 [-Wfortify-source]

When we have a string literal that does not contain any format flags,
rather than use snprintf (sometimes with a size that's too small), let's
use sprintf.

This is pattern is cleaned up throughout two files.

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Nick Desaulniers (2):
      scsi: myrb: fix -Wfortify-source
      scsi: myrs: fix -Wfortify-source

 drivers/scsi/myrb.c |  8 ++++----
 drivers/scsi/myrs.c | 14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)
---
base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c
change-id: 20230828-scsi_fortify-9f8d279bf9aa

Best regards,
-- 
Nick Desaulniers <ndesaulniers@google.com>


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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 22:25 Nick Desaulniers [this message]
2023-08-28 22:25 ` [PATCH 1/2] scsi: myrb: fix -Wfortify-source Nick Desaulniers
2023-08-28 22:25 ` [PATCH 2/2] scsi: myrs: " Nick Desaulniers
2023-08-28 23:41 ` [PATCH 0/2] scsi: fix 2 cases of -Wfortify-source Nick Desaulniers
2023-08-29 16:33   ` Nick Desaulniers
2023-08-29 18:48     ` Kees Cook

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=20230828-scsi_fortify-v1-0-8dde624a3b2c@google.com \
    --to=ndesaulniers@google.com \
    --cc=hare@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=martin.petersen@oracle.com \
    --cc=nathan@kernel.org \
    --cc=trix@redhat.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

all inboxes | Powered by JetHome®