From: Arnd Bergmann <arnd@arndb.de>
To: linux-scsi@vger.kernel.org,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
Johannes Thumshirn <jth@kernel.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Nicolas Pitre <nico@linaro.org>, Andi Kleen <ak@linux.intel.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings
Date: Fri, 2 Feb 2018 14:12:15 +0100 [thread overview]
Message-ID: <20180202131225.1658853-2-arnd@arndb.de> (raw)
In-Reply-To: <20180202131225.1658853-1-arnd@arndb.de>
struct fc_fdmi_attr_entry contains a variable-length string at
the end, which is encoded as a one-byte array. gcc-8 notices that
we copy strings into it that obviously go beyond that one byte:
In function 'fc_ct_ms_fill',
inlined from 'fc_elsct_send' at include/scsi/fc_encode.h:518:8:
include/scsi/fc_encode.h:275:3: error: 'strncpy' writing 64 bytes into a region of size 1 overflows the destination [-Werror=stringop-overflow=]
strncpy((char *)&entry->value,
^
include/scsi/fc_encode.h:287:3: error: 'strncpy' writing 64 bytes into a region of size 1 overflows the destination [-Werror=stringop-overflow=]
strncpy((char *)&entry->value,
^
No idea what the right fix is.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/scsi/fc/fc_ms.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h
index f52b921b5c70..c5614e725a0e 100644
--- a/include/scsi/fc/fc_ms.h
+++ b/include/scsi/fc/fc_ms.h
@@ -128,7 +128,7 @@ struct fc_fdmi_port_name {
struct fc_fdmi_attr_entry {
__be16 type;
__be16 len;
- __u8 value[1];
+ __u8 value[];
} __attribute__((__packed__));
/*
--
2.9.0
next parent reply other threads:[~2018-02-02 13:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180202131225.1658853-1-arnd@arndb.de>
2018-02-02 13:12 ` Arnd Bergmann [this message]
2018-02-02 13:12 ` [PATCH 2/6] scsi: NCR53c406a: avoid section mismatch with LTO Arnd Bergmann
2018-02-09 23:47 ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 3/6] scsi: sym53c416: " Arnd Bergmann
2018-02-09 23:47 ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 4/6] scsi: qedf: fix LTO-enabled build Arnd Bergmann
2018-02-07 15:38 ` Chad Dupuis
2018-02-09 23:24 ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 5/6] scsi: qedi: fix building with LTO Arnd Bergmann
2018-02-05 6:08 ` Rangankar, Manish
2018-02-07 1:24 ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 6/6] scsi: qedf: use correct strncpy() size Arnd Bergmann
2018-02-05 2:56 ` kbuild test robot
2018-02-07 16:26 ` Chad Dupuis
2018-02-09 23:36 ` Martin K. Petersen
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=20180202131225.1658853-2-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=ak@linux.intel.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=jth@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nico@linaro.org \
/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®