scsi: esas2r: Fix format string type mistakes
authorEmese Revfy <re.emese@gmail.com>
Wed, 4 Jan 2017 00:01:40 +0000 (16:01 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 10 Jan 2017 04:52:26 +0000 (23:52 -0500)
This adds the missing __printf attribute which allows compile time
format string checking (and will be used by the coming initify gcc
plugin). Additionally, this fixes the warnings exposed by the attribute.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
[kees: split scsi/acpi, merged attr and fix, new commit messages]
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/esas2r/esas2r_init.c
drivers/scsi/esas2r/esas2r_ioctl.c
drivers/scsi/esas2r/esas2r_log.h
drivers/scsi/esas2r/esas2r_main.c

index d6e53aee22952190af34ce0f99fd1984a4d6a9c1..6432a50b26d853aaa2e6ede3f89e3d1982c42b2b 100644 (file)
@@ -237,7 +237,7 @@ static void esas2r_claim_interrupts(struct esas2r_adapter *a)
                flags |= IRQF_SHARED;
 
        esas2r_log(ESAS2R_LOG_INFO,
-                  "esas2r_claim_interrupts irq=%d (%p, %s, %x)",
+                  "esas2r_claim_interrupts irq=%d (%p, %s, %lx)",
                   a->pcid->irq, a, a->name, flags);
 
        if (request_irq(a->pcid->irq,
index 3e8483410f610997746edf9ab65585a1b8982153..b35ed382942120a91588102150ba014c9539f2f5 100644 (file)
@@ -1301,7 +1301,7 @@ int esas2r_ioctl_handler(void *hostdata, int cmd, void __user *arg)
        ioctl = kzalloc(sizeof(struct atto_express_ioctl), GFP_KERNEL);
        if (ioctl == NULL) {
                esas2r_log(ESAS2R_LOG_WARN,
-                          "ioctl_handler kzalloc failed for %d bytes",
+                          "ioctl_handler kzalloc failed for %zu bytes",
                           sizeof(struct atto_express_ioctl));
                return -ENOMEM;
        }
index 7b6397bb5b9438184db03887e262aa8501e20b42..75b9d23cd736307d7da13d9adc972294b7fb470a 100644 (file)
@@ -61,8 +61,8 @@ enum {
 #endif
 };
 
-int esas2r_log(const long level, const char *format, ...);
-int esas2r_log_dev(const long level,
+__printf(2, 3) int esas2r_log(const long level, const char *format, ...);
+__printf(3, 4) int esas2r_log_dev(const long level,
                   const struct device *dev,
                   const char *format,
                   ...);
index 5092c821d0887d09c23679bde31e1295eb71d518..f2e9d8aa979ca66c0f9226834b3d7ae8bd62769d 100644 (file)
@@ -198,7 +198,7 @@ static ssize_t write_hw(struct file *file, struct kobject *kobj,
                                              GFP_KERNEL);
                if (a->local_atto_ioctl == NULL) {
                        esas2r_log(ESAS2R_LOG_WARN,
-                                  "write_hw kzalloc failed for %d bytes",
+                                  "write_hw kzalloc failed for %zu bytes",
                                   sizeof(struct atto_ioctl));
                        return -ENOMEM;
                }
@@ -1186,7 +1186,7 @@ retry:
                } else {
                        esas2r_log(ESAS2R_LOG_CRIT,
                                   "unable to allocate a request for a "
-                                  "device reset (%d:%d)!",
+                                  "device reset (%d:%llu)!",
                                   cmd->device->id,
                                   cmd->device->lun);
                }