* [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings
[not found] <20180202131225.1658853-1-arnd@arndb.de>
@ 2018-02-02 13:12 ` Arnd Bergmann
2018-02-02 13:12 ` [PATCH 2/6] scsi: NCR53c406a: avoid section mismatch with LTO Arnd Bergmann
` (4 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2018-02-02 13:12 UTC (permalink / raw)
To: linux-scsi, James E . J . Bottomley, Johannes Thumshirn,
Martin K. Petersen
Cc: Nicolas Pitre, Andi Kleen, Arnd Bergmann, linux-kernel
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
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/6] scsi: NCR53c406a: avoid section mismatch with LTO
[not found] <20180202131225.1658853-1-arnd@arndb.de>
2018-02-02 13:12 ` [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings Arnd Bergmann
@ 2018-02-02 13:12 ` Arnd Bergmann
2018-02-09 23:47 ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 3/6] scsi: sym53c416: " Arnd Bergmann
` (3 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2018-02-02 13:12 UTC (permalink / raw)
To: linux-scsi, James E . J . Bottomley, Martin K. Petersen
Cc: Nicolas Pitre, Andi Kleen, Arnd Bergmann, linux-kernel
Building with link time optimizations produces a false-postive section
mismatch warning:
WARNING: vmlinux.o(.data+0xf7e8): Section mismatch in reference from the variable driver_template.lto_priv.6914 to the function .init.text:NCR53c406a_detect()
The variable driver_template.lto_priv.6914 references
the function __init NCR53c406a_detect()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
The ->detect callback is always entered from the init_this_scsi_driver()
init function, but apparently LTO turns the optimized direct function
call into an indirect call through a non-__initdata pointer.
All drivers using init_this_scsi_driver() are for ancient hardware,
and most don't mark the detect() callback as __init(), so I'm
just removing the annotation here to kill off the warning instead
of doing a larger rework.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/NCR53c406a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index 6e110c630d2c..44b09870bf51 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -448,7 +448,7 @@ static __inline__ int NCR53c406a_pio_write(unsigned char *request, unsigned int
}
#endif /* USE_PIO */
-static int __init NCR53c406a_detect(struct scsi_host_template * tpnt)
+static int NCR53c406a_detect(struct scsi_host_template * tpnt)
{
int present = 0;
struct Scsi_Host *shpnt = NULL;
--
2.9.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/6] scsi: sym53c416: avoid section mismatch with LTO
[not found] <20180202131225.1658853-1-arnd@arndb.de>
2018-02-02 13:12 ` [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings Arnd Bergmann
2018-02-02 13:12 ` [PATCH 2/6] scsi: NCR53c406a: avoid section mismatch with LTO Arnd Bergmann
@ 2018-02-02 13:12 ` 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
` (2 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2018-02-02 13:12 UTC (permalink / raw)
To: linux-scsi, James E . J . Bottomley, Martin K. Petersen
Cc: Nicolas Pitre, Andi Kleen, Arnd Bergmann, linux-kernel
Building with link time optimizations produces a false-postive section
mismatch warning:
WARNING: vmlinux.o(.data+0xf8c8): Section mismatch in reference from the variable driver_template.lto_priv.6915 to the function .init.text:sym53c416_detect()
The variable driver_template.lto_priv.6915 references
the function __init sym53c416_detect()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
The ->detect callback is always entered from the init_this_scsi_driver()
init function, but apparently LTO turns the optimized direct function
call into an indirect call through a non-__initdata pointer.
All drivers using init_this_scsi_driver() are for ancient hardware,
and most don't mark the detect() callback as __init(), so I'm
just removing the annotation here to kill off the warning instead
of doing a larger rework.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/sym53c416.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index 5bdcbe8fa958..e68bcdc75bc3 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -608,7 +608,7 @@ static void sym53c416_probe(void)
}
}
-int __init sym53c416_detect(struct scsi_host_template *tpnt)
+int sym53c416_detect(struct scsi_host_template *tpnt)
{
unsigned long flags;
struct Scsi_Host * shpnt = NULL;
--
2.9.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/6] scsi: qedf: fix LTO-enabled build
[not found] <20180202131225.1658853-1-arnd@arndb.de>
` (2 preceding siblings ...)
2018-02-02 13:12 ` [PATCH 3/6] scsi: sym53c416: " Arnd Bergmann
@ 2018-02-02 13:12 ` 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-02 13:12 ` [PATCH 6/6] scsi: qedf: use correct strncpy() size Arnd Bergmann
5 siblings, 2 replies; 15+ messages in thread
From: Arnd Bergmann @ 2018-02-02 13:12 UTC (permalink / raw)
To: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen
Cc: Nicolas Pitre, Andi Kleen, Arnd Bergmann, Chad Dupuis,
Nilesh Javali, linux-kernel
The prototype for qedf_dbg_fops/qedf_debugfs_ops doesn't match the definition,
which causes the final link to fail with link-time optimizations:
drivers/scsi/qedf/qedf_main.c:34: error: type of 'qedf_dbg_fops' does not match original declaration [-Werror=lto-type-mismatch]
extern struct file_operations qedf_dbg_fops;
drivers/scsi/qedf/qedf_debugfs.c:443: note: 'qedf_dbg_fops' was previously declared here
const struct file_operations qedf_dbg_fops[] = {
drivers/scsi/qedf/qedf_main.c:33: error: type of 'qedf_debugfs_ops' does not match original declaration [-Werror=lto-type-mismatch]
extern struct qedf_debugfs_ops qedf_debugfs_ops;
drivers/scsi/qedf/qedf_debugfs.c:102: note: 'qedf_debugfs_ops' was previously declared here
struct qedf_debugfs_ops qedf_debugfs_ops[] = {
This corrects the prototype and moves it into a shared header file where it
belongs. The file operations can also be marked 'const' like the
qedf_debugfs_ops.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/qedf/qedf_dbg.h | 17 ++++++++++-------
drivers/scsi/qedf/qedf_debugfs.c | 6 +++---
drivers/scsi/qedf/qedf_main.c | 8 +++-----
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/scsi/qedf/qedf_dbg.h b/drivers/scsi/qedf/qedf_dbg.h
index 50083cae84c3..77c27e888969 100644
--- a/drivers/scsi/qedf/qedf_dbg.h
+++ b/drivers/scsi/qedf/qedf_dbg.h
@@ -116,6 +116,14 @@ extern int qedf_create_sysfs_attr(struct Scsi_Host *shost,
extern void qedf_remove_sysfs_attr(struct Scsi_Host *shost,
struct sysfs_bin_attrs *iter);
+struct qedf_debugfs_ops {
+ char *name;
+ struct qedf_list_of_funcs *qedf_funcs;
+};
+
+extern const struct qedf_debugfs_ops qedf_debugfs_ops[];
+extern const struct file_operations qedf_dbg_fops[];
+
#ifdef CONFIG_DEBUG_FS
/* DebugFS related code */
struct qedf_list_of_funcs {
@@ -123,11 +131,6 @@ struct qedf_list_of_funcs {
ssize_t (*oper_func)(struct qedf_dbg_ctx *qedf);
};
-struct qedf_debugfs_ops {
- char *name;
- struct qedf_list_of_funcs *qedf_funcs;
-};
-
#define qedf_dbg_fileops(drv, ops) \
{ \
.owner = THIS_MODULE, \
@@ -147,8 +150,8 @@ struct qedf_debugfs_ops {
}
extern void qedf_dbg_host_init(struct qedf_dbg_ctx *qedf,
- struct qedf_debugfs_ops *dops,
- struct file_operations *fops);
+ const struct qedf_debugfs_ops *dops,
+ const struct file_operations *fops);
extern void qedf_dbg_host_exit(struct qedf_dbg_ctx *qedf);
extern void qedf_dbg_init(char *drv_name);
extern void qedf_dbg_exit(void);
diff --git a/drivers/scsi/qedf/qedf_debugfs.c b/drivers/scsi/qedf/qedf_debugfs.c
index 2b1ef3075e93..c539a7ae3a7e 100644
--- a/drivers/scsi/qedf/qedf_debugfs.c
+++ b/drivers/scsi/qedf/qedf_debugfs.c
@@ -23,8 +23,8 @@ static struct dentry *qedf_dbg_root;
**/
void
qedf_dbg_host_init(struct qedf_dbg_ctx *qedf,
- struct qedf_debugfs_ops *dops,
- struct file_operations *fops)
+ const struct qedf_debugfs_ops *dops,
+ const struct file_operations *fops)
{
char host_dirname[32];
struct dentry *file_dentry = NULL;
@@ -99,7 +99,7 @@ qedf_dbg_exit(void)
qedf_dbg_root = NULL;
}
-struct qedf_debugfs_ops qedf_debugfs_ops[] = {
+const struct qedf_debugfs_ops qedf_debugfs_ops[] = {
{ "fp_int", NULL },
{ "io_trace", NULL },
{ "debug", NULL },
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index ccd9a08ea030..284ccb566b19 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -23,6 +23,7 @@
#include <linux/if_vlan.h>
#include <linux/cpu.h>
#include "qedf.h"
+#include "qedf_dbg.h"
#include <uapi/linux/pci_regs.h>
const struct qed_fcoe_ops *qed_ops;
@@ -30,9 +31,6 @@ const struct qed_fcoe_ops *qed_ops;
static int qedf_probe(struct pci_dev *pdev, const struct pci_device_id *id);
static void qedf_remove(struct pci_dev *pdev);
-extern struct qedf_debugfs_ops qedf_debugfs_ops;
-extern struct file_operations qedf_dbg_fops;
-
/*
* Driver module parameters.
*/
@@ -3155,8 +3153,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
}
#ifdef CONFIG_DEBUG_FS
- qedf_dbg_host_init(&(qedf->dbg_ctx), &qedf_debugfs_ops,
- &qedf_dbg_fops);
+ qedf_dbg_host_init(&(qedf->dbg_ctx), qedf_debugfs_ops,
+ qedf_dbg_fops);
#endif
/* Start LL2 */
--
2.9.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/6] scsi: qedi: fix building with LTO
[not found] <20180202131225.1658853-1-arnd@arndb.de>
` (3 preceding siblings ...)
2018-02-02 13:12 ` [PATCH 4/6] scsi: qedf: fix LTO-enabled build Arnd Bergmann
@ 2018-02-02 13:12 ` 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
5 siblings, 2 replies; 15+ messages in thread
From: Arnd Bergmann @ 2018-02-02 13:12 UTC (permalink / raw)
To: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen
Cc: Nicolas Pitre, Andi Kleen, Arnd Bergmann, Manish Rangankar,
Tomer Tayar, David S. Miller, Ariel Elior, Arun Easi,
Nilesh Javali, linux-kernel
When link-time optimizations are enabled, qedi fails to build because
of mismatched prototypes:
drivers/scsi/qedi/qedi_gbl.h:27:37: error: type of 'qedi_dbg_fops' does not match original declaration [-Werror=lto-type-mismatch]
extern const struct file_operations qedi_dbg_fops;
^
drivers/scsi/qedi/qedi_debugfs.c:239:30: note: 'qedi_dbg_fops' was previously declared here
const struct file_operations qedi_dbg_fops[] = {
^
drivers/scsi/qedi/qedi_gbl.h:26:32: error: type of 'qedi_debugfs_ops' does not match original declaration [-Werror=lto-type-mismatch]
extern struct qedi_debugfs_ops qedi_debugfs_ops;
^
drivers/scsi/qedi/qedi_debugfs.c:102:25: note: 'qedi_debugfs_ops' was previously declared here
struct qedi_debugfs_ops qedi_debugfs_ops[] = {
This changes the declaration to match the definition, and adapts the
users as necessary. Since both array can be constant here, I'm adding
the 'const' everywhere for consistency.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/qedi/qedi_dbg.h | 2 +-
drivers/scsi/qedi/qedi_debugfs.c | 4 ++--
drivers/scsi/qedi/qedi_gbl.h | 4 ++--
drivers/scsi/qedi/qedi_main.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/qedi/qedi_dbg.h b/drivers/scsi/qedi/qedi_dbg.h
index c55572badfb0..358f40567849 100644
--- a/drivers/scsi/qedi/qedi_dbg.h
+++ b/drivers/scsi/qedi/qedi_dbg.h
@@ -134,7 +134,7 @@ struct qedi_debugfs_ops {
}
void qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
- struct qedi_debugfs_ops *dops,
+ const struct qedi_debugfs_ops *dops,
const struct file_operations *fops);
void qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi);
void qedi_dbg_init(char *drv_name);
diff --git a/drivers/scsi/qedi/qedi_debugfs.c b/drivers/scsi/qedi/qedi_debugfs.c
index fd8a1eea3163..fd914ca4149a 100644
--- a/drivers/scsi/qedi/qedi_debugfs.c
+++ b/drivers/scsi/qedi/qedi_debugfs.c
@@ -19,7 +19,7 @@ static struct dentry *qedi_dbg_root;
void
qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
- struct qedi_debugfs_ops *dops,
+ const struct qedi_debugfs_ops *dops,
const struct file_operations *fops)
{
char host_dirname[32];
@@ -99,7 +99,7 @@ static struct qedi_list_of_funcs qedi_dbg_do_not_recover_ops[] = {
{ NULL, NULL }
};
-struct qedi_debugfs_ops qedi_debugfs_ops[] = {
+const struct qedi_debugfs_ops qedi_debugfs_ops[] = {
{ "gbl_ctx", NULL },
{ "do_not_recover", qedi_dbg_do_not_recover_ops},
{ "io_trace", NULL },
diff --git a/drivers/scsi/qedi/qedi_gbl.h b/drivers/scsi/qedi/qedi_gbl.h
index f5b5a31999aa..a2aa06ed1620 100644
--- a/drivers/scsi/qedi/qedi_gbl.h
+++ b/drivers/scsi/qedi/qedi_gbl.h
@@ -23,8 +23,8 @@ extern uint qedi_io_tracing;
extern struct scsi_host_template qedi_host_template;
extern struct iscsi_transport qedi_iscsi_transport;
extern const struct qed_iscsi_ops *qedi_ops;
-extern struct qedi_debugfs_ops qedi_debugfs_ops;
-extern const struct file_operations qedi_dbg_fops;
+extern const struct qedi_debugfs_ops qedi_debugfs_ops[];
+extern const struct file_operations qedi_dbg_fops[];
extern struct device_attribute *qedi_shost_attrs[];
int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep);
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 029e2e69b29f..e992f9d3ef00 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -2303,8 +2303,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
}
#ifdef CONFIG_DEBUG_FS
- qedi_dbg_host_init(&qedi->dbg_ctx, &qedi_debugfs_ops,
- &qedi_dbg_fops);
+ qedi_dbg_host_init(&qedi->dbg_ctx, qedi_debugfs_ops,
+ qedi_dbg_fops);
#endif
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
"QLogic FastLinQ iSCSI Module qedi %s, FW %d.%d.%d.%d\n",
--
2.9.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/6] scsi: qedf: use correct strncpy() size
[not found] <20180202131225.1658853-1-arnd@arndb.de>
` (4 preceding siblings ...)
2018-02-02 13:12 ` [PATCH 5/6] scsi: qedi: fix building with LTO Arnd Bergmann
@ 2018-02-02 13:12 ` Arnd Bergmann
2018-02-05 2:56 ` kbuild test robot
` (2 more replies)
5 siblings, 3 replies; 15+ messages in thread
From: Arnd Bergmann @ 2018-02-02 13:12 UTC (permalink / raw)
To: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen
Cc: Nicolas Pitre, Andi Kleen, Arnd Bergmann, Saurav Kashyap, Dupuis,
Chad, Arun Easi, Nilesh Javali, linux-kernel
gcc-8 warns during link-time optimization that the strncpy() call
passes the size of the source buffer rather than the destination:
drivers/scsi/qedf/qedf_dbg.c: In function 'qedf_uevent_emit':
include/linux/string.h:253: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
This changes it to strscpy() with the correct length, guaranteeing
a properly nul-terminated string of the right size.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/qedf/qedf_dbg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/qedf/qedf_dbg.c b/drivers/scsi/qedf/qedf_dbg.c
index e023f5d0dc12..bd1cef25a900 100644
--- a/drivers/scsi/qedf/qedf_dbg.c
+++ b/drivers/scsi/qedf/qedf_dbg.c
@@ -160,7 +160,7 @@ qedf_uevent_emit(struct Scsi_Host *shost, u32 code, char *msg)
switch (code) {
case QEDF_UEVENT_CODE_GRCDUMP:
if (msg)
- strncpy(event_string, msg, strlen(msg));
+ strscpy(event_string, msg, sizeof(event_string));
else
sprintf(event_string, "GRCDUMP=%u", shost->host_no);
break;
--
2.9.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 6/6] scsi: qedf: use correct strncpy() size
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
2 siblings, 0 replies; 15+ messages in thread
From: kbuild test robot @ 2018-02-05 2:56 UTC (permalink / raw)
To: Arnd Bergmann
Cc: kbuild-all, linux-scsi, James E . J . Bottomley,
QLogic-Storage-Upstream, Martin K. Petersen, Nicolas Pitre,
Andi Kleen, Arnd Bergmann, Saurav Kashyap, Dupuis, Chad,
Arun Easi, Nilesh Javali, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]
Hi Arnd,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/scsi-fixes-for-building-with-LTO/20180205-083607
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
drivers/scsi//qedf/qedf_dbg.c: In function 'qedf_uevent_emit':
>> drivers/scsi//qedf/qedf_dbg.c:163:4: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
strscpy(event_string, msg, sizeof(event_string));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strscpy +163 drivers/scsi//qedf/qedf_dbg.c
152
153 void
154 qedf_uevent_emit(struct Scsi_Host *shost, u32 code, char *msg)
155 {
156 char event_string[40];
157 char *envp[] = {event_string, NULL};
158
159 memset(event_string, 0, sizeof(event_string));
160 switch (code) {
161 case QEDF_UEVENT_CODE_GRCDUMP:
162 if (msg)
> 163 strscpy(event_string, msg, sizeof(event_string));
164 else
165 sprintf(event_string, "GRCDUMP=%u", shost->host_no);
166 break;
167 default:
168 /* do nothing */
169 break;
170 }
171
172 kobject_uevent_env(&shost->shost_gendev.kobj, KOBJ_CHANGE, envp);
173 }
174
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52606 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/6] scsi: qedi: fix building with LTO
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
1 sibling, 0 replies; 15+ messages in thread
From: Rangankar, Manish @ 2018-02-05 6:08 UTC (permalink / raw)
To: Arnd Bergmann, linux-scsi, James E . J . Bottomley,
Dept-Eng QLogic Storage Upstream, Martin K. Petersen
Cc: Nicolas Pitre, Andi Kleen, Tayar, Tomer, David S. Miller, Elior,
Ariel, Easi, Arun, Javali, Nilesh, linux-kernel
On 02/02/18 6:42 PM, "Arnd Bergmann" <arnd@arndb.de> wrote:
>When link-time optimizations are enabled, qedi fails to build because
>of mismatched prototypes:
>
>drivers/scsi/qedi/qedi_gbl.h:27:37: error: type of 'qedi_dbg_fops' does
>not match original declaration [-Werror=lto-type-mismatch]
> extern const struct file_operations qedi_dbg_fops;
> ^
>drivers/scsi/qedi/qedi_debugfs.c:239:30: note: 'qedi_dbg_fops' was
>previously declared here
> const struct file_operations qedi_dbg_fops[] = {
> ^
>drivers/scsi/qedi/qedi_gbl.h:26:32: error: type of 'qedi_debugfs_ops'
>does not match original declaration [-Werror=lto-type-mismatch]
> extern struct qedi_debugfs_ops qedi_debugfs_ops;
> ^
>drivers/scsi/qedi/qedi_debugfs.c:102:25: note: 'qedi_debugfs_ops' was
>previously declared here
> struct qedi_debugfs_ops qedi_debugfs_ops[] = {
>
>This changes the declaration to match the definition, and adapts the
>users as necessary. Since both array can be constant here, I'm adding
>the 'const' everywhere for consistency.
>
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>---
> drivers/scsi/qedi/qedi_dbg.h | 2 +-
> drivers/scsi/qedi/qedi_debugfs.c | 4 ++--
> drivers/scsi/qedi/qedi_gbl.h | 4 ++--
> drivers/scsi/qedi/qedi_main.c | 4 ++--
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/qedi/qedi_dbg.h b/drivers/scsi/qedi/qedi_dbg.h
>index c55572badfb0..358f40567849 100644
>--- a/drivers/scsi/qedi/qedi_dbg.h
>+++ b/drivers/scsi/qedi/qedi_dbg.h
>@@ -134,7 +134,7 @@ struct qedi_debugfs_ops {
> }
>
> void qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
>- struct qedi_debugfs_ops *dops,
>+ const struct qedi_debugfs_ops *dops,
> const struct file_operations *fops);
> void qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi);
> void qedi_dbg_init(char *drv_name);
>diff --git a/drivers/scsi/qedi/qedi_debugfs.c
>b/drivers/scsi/qedi/qedi_debugfs.c
>index fd8a1eea3163..fd914ca4149a 100644
>--- a/drivers/scsi/qedi/qedi_debugfs.c
>+++ b/drivers/scsi/qedi/qedi_debugfs.c
>@@ -19,7 +19,7 @@ static struct dentry *qedi_dbg_root;
>
> void
> qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
>- struct qedi_debugfs_ops *dops,
>+ const struct qedi_debugfs_ops *dops,
> const struct file_operations *fops)
> {
> char host_dirname[32];
>@@ -99,7 +99,7 @@ static struct qedi_list_of_funcs
>qedi_dbg_do_not_recover_ops[] = {
> { NULL, NULL }
> };
>
>-struct qedi_debugfs_ops qedi_debugfs_ops[] = {
>+const struct qedi_debugfs_ops qedi_debugfs_ops[] = {
> { "gbl_ctx", NULL },
> { "do_not_recover", qedi_dbg_do_not_recover_ops},
> { "io_trace", NULL },
>diff --git a/drivers/scsi/qedi/qedi_gbl.h b/drivers/scsi/qedi/qedi_gbl.h
>index f5b5a31999aa..a2aa06ed1620 100644
>--- a/drivers/scsi/qedi/qedi_gbl.h
>+++ b/drivers/scsi/qedi/qedi_gbl.h
>@@ -23,8 +23,8 @@ extern uint qedi_io_tracing;
> extern struct scsi_host_template qedi_host_template;
> extern struct iscsi_transport qedi_iscsi_transport;
> extern const struct qed_iscsi_ops *qedi_ops;
>-extern struct qedi_debugfs_ops qedi_debugfs_ops;
>-extern const struct file_operations qedi_dbg_fops;
>+extern const struct qedi_debugfs_ops qedi_debugfs_ops[];
>+extern const struct file_operations qedi_dbg_fops[];
> extern struct device_attribute *qedi_shost_attrs[];
>
> int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep);
>diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
>index 029e2e69b29f..e992f9d3ef00 100644
>--- a/drivers/scsi/qedi/qedi_main.c
>+++ b/drivers/scsi/qedi/qedi_main.c
>@@ -2303,8 +2303,8 @@ static int __qedi_probe(struct pci_dev *pdev, int
>mode)
> }
>
> #ifdef CONFIG_DEBUG_FS
>- qedi_dbg_host_init(&qedi->dbg_ctx, &qedi_debugfs_ops,
>- &qedi_dbg_fops);
>+ qedi_dbg_host_init(&qedi->dbg_ctx, qedi_debugfs_ops,
>+ qedi_dbg_fops);
> #endif
> QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
> "QLogic FastLinQ iSCSI Module qedi %s, FW %d.%d.%d.%d\n",
>--
>2.9.0
Thanks
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/6] scsi: qedi: fix building with LTO
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
1 sibling, 0 replies; 15+ messages in thread
From: Martin K. Petersen @ 2018-02-07 1:24 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen, Nicolas Pitre, Andi Kleen, Manish Rangankar,
Tomer Tayar, David S. Miller, Ariel Elior, Arun Easi,
Nilesh Javali, linux-kernel
Arnd,
> When link-time optimizations are enabled, qedi fails to build because
> of mismatched prototypes:
Applied to 4.17/scsi-queue. Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/6] scsi: qedf: fix LTO-enabled build
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
1 sibling, 0 replies; 15+ messages in thread
From: Chad Dupuis @ 2018-02-07 15:38 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen, Nicolas Pitre, Andi Kleen, Nilesh Javali,
linux-kernel
On Fri, 2 Feb 2018, 8:12am, Arnd Bergmann wrote:
> The prototype for qedf_dbg_fops/qedf_debugfs_ops doesn't match the definition,
> which causes the final link to fail with link-time optimizations:
>
> drivers/scsi/qedf/qedf_main.c:34: error: type of 'qedf_dbg_fops' does not match original declaration [-Werror=lto-type-mismatch]
> extern struct file_operations qedf_dbg_fops;
>
> drivers/scsi/qedf/qedf_debugfs.c:443: note: 'qedf_dbg_fops' was previously declared here
> const struct file_operations qedf_dbg_fops[] = {
>
> drivers/scsi/qedf/qedf_main.c:33: error: type of 'qedf_debugfs_ops' does not match original declaration [-Werror=lto-type-mismatch]
> extern struct qedf_debugfs_ops qedf_debugfs_ops;
>
> drivers/scsi/qedf/qedf_debugfs.c:102: note: 'qedf_debugfs_ops' was previously declared here
> struct qedf_debugfs_ops qedf_debugfs_ops[] = {
>
> This corrects the prototype and moves it into a shared header file where it
> belongs. The file operations can also be marked 'const' like the
> qedf_debugfs_ops.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/scsi/qedf/qedf_dbg.h | 17 ++++++++++-------
> drivers/scsi/qedf/qedf_debugfs.c | 6 +++---
> drivers/scsi/qedf/qedf_main.c | 8 +++-----
> 3 files changed, 16 insertions(+), 15 deletions(-)
>
Thanks.
Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 6/6] scsi: qedf: use correct strncpy() size
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
2 siblings, 0 replies; 15+ messages in thread
From: Chad Dupuis @ 2018-02-07 16:26 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen, Nicolas Pitre, Andi Kleen, Saurav Kashyap,
Arun Easi, Nilesh Javali, linux-kernel
On Fri, 2 Feb 2018, 8:12am, Arnd Bergmann wrote:
> gcc-8 warns during link-time optimization that the strncpy() call
> passes the size of the source buffer rather than the destination:
>
> drivers/scsi/qedf/qedf_dbg.c: In function 'qedf_uevent_emit':
> include/linux/string.h:253: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
>
> This changes it to strscpy() with the correct length, guaranteeing
> a properly nul-terminated string of the right size.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/scsi/qedf/qedf_dbg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reasonable security precaution.
Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/6] scsi: qedf: fix LTO-enabled build
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
1 sibling, 0 replies; 15+ messages in thread
From: Martin K. Petersen @ 2018-02-09 23:24 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen, Nicolas Pitre, Andi Kleen, Chad Dupuis,
Nilesh Javali, linux-kernel
Arnd,
> The prototype for qedf_dbg_fops/qedf_debugfs_ops doesn't match the
> definition, which causes the final link to fail with link-time
> optimizations:
Applied to 4.17/scsi-queue. Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 6/6] scsi: qedf: use correct strncpy() size
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
2 siblings, 0 replies; 15+ messages in thread
From: Martin K. Petersen @ 2018-02-09 23:36 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-scsi, James E . J . Bottomley, QLogic-Storage-Upstream,
Martin K. Petersen, Nicolas Pitre, Andi Kleen, Saurav Kashyap,
Dupuis, Chad, Arun Easi, Nilesh Javali, linux-kernel
Arnd,
> gcc-8 warns during link-time optimization that the strncpy() call
> passes the size of the source buffer rather than the destination:
Applied to 4.17/scsi-queue. Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] scsi: NCR53c406a: avoid section mismatch with LTO
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
0 siblings, 0 replies; 15+ messages in thread
From: Martin K. Petersen @ 2018-02-09 23:47 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-scsi, James E . J . Bottomley, Martin K. Petersen,
Nicolas Pitre, Andi Kleen, linux-kernel
Arnd,
> Building with link time optimizations produces a false-postive section
> mismatch warning:
Applied to 4.17/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/6] scsi: sym53c416: avoid section mismatch with LTO
2018-02-02 13:12 ` [PATCH 3/6] scsi: sym53c416: " Arnd Bergmann
@ 2018-02-09 23:47 ` Martin K. Petersen
0 siblings, 0 replies; 15+ messages in thread
From: Martin K. Petersen @ 2018-02-09 23:47 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-scsi, James E . J . Bottomley, Martin K. Petersen,
Nicolas Pitre, Andi Kleen, linux-kernel
Arnd,
> Building with link time optimizations produces a false-postive section
> mismatch warning:
Applied to 4.17/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2018-02-09 23:58 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20180202131225.1658853-1-arnd@arndb.de>
2018-02-02 13:12 ` [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings Arnd Bergmann
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
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 NNTP newsgroup(s).