Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1547316
| Path | csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] scsi: qla2xxx: silent -Wformat-security warning |
| Date | Mon, 26 Dec 2016 14:30:02 +0100 |
| Message-ID | <sSDvI-5kc-1@gated-at.bofh.it> (permalink) |
| X-Mailer | git-send-email 2.11.0 |
| X-Av-Checked | ClamAV using ClamSMTP at svoboda.polytechnique.org (Mon Dec 26 14:23:53 2016 +0100 (CET)) |
| X-Spam-Flag | No, tests=bogofilter, spamicity=0.000483, queueID=D1F055646C6 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 58 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
| X-Original-Date | Mon, 26 Dec 2016 14:23:09 +0100 |
| X-Original-Message-ID | <20161226132310.3204-1-nicolas.iooss_linux@m4x.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1547316 |
Show key headers only | View raw
qla24xx_enable_msix() calls scnprintf() with a non-literal format
string. This makes clang report -Wformat-security warnings when
compiling this function:
drivers/scsi/qla2xxx/qla_isr.c:3083:7: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
msix_entries[i].name);
^~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:3083:7: note: treat the string as an
argument to avoid this
msix_entries[i].name);
^
"%s",
drivers/scsi/qla2xxx/qla_isr.c:3119:7: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
msix_entries[QLA_ATIO_VECTOR].name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:3119:7: note: treat the string as an
argument to avoid this
msix_entries[QLA_ATIO_VECTOR].name);
^
"%s",
Even though msix_entries[...].name are initialized as literal strings
with no % character and are never modified, introduce a "%s" format
parameter in order to silent this -Wformat-security warning and make
clang able to detect at compile time real bugs related to string
formatting.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
drivers/scsi/qla2xxx/qla_isr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 5093ca9b02ec..474b415217df 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3080,7 +3080,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
qentry->handle = rsp;
rsp->msix = qentry;
scnprintf(qentry->name, sizeof(qentry->name),
- msix_entries[i].name);
+ "%s", msix_entries[i].name);
if (IS_P3P_TYPE(ha))
ret = request_irq(qentry->vector,
qla82xx_msix_entries[i].handler,
@@ -3116,7 +3116,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
rsp->msix = qentry;
qentry->handle = rsp;
scnprintf(qentry->name, sizeof(qentry->name),
- msix_entries[QLA_ATIO_VECTOR].name);
+ "%s", msix_entries[QLA_ATIO_VECTOR].name);
qentry->in_use = 1;
ret = request_irq(qentry->vector,
msix_entries[QLA_ATIO_VECTOR].handler,
--
2.11.0
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 1/2] scsi: qla2xxx: silent -Wformat-security warning Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-12-26 14:30 +0100 [PATCH 2/2] scsi: qla2xxx: make msix_entries const Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-12-26 14:30 +0100
csiph-web