From: Arnd Bergmann <arnd@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dave Penkler <dpenkler@gmail.com>
Cc: linux-staging@lists.linux.dev, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 6/7] staging: gpib: use proper format string in request_module
Date: Wed, 16 Oct 2024 11:15:20 +0000 [thread overview]
Message-ID: <20241016111521.1143191-7-arnd@kernel.org> (raw)
In-Reply-To: <20241016111521.1143191-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
Using a string variable as a format causes a -Wformat-security
warning. Since the only use of the temporary module_string[] is to hold
the sprintf() output, just pass the format string and argument directly
to request_module().
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/staging/gpib/common/gpib_os.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c
index e93a45132a40..6b12404efe7d 100644
--- a/drivers/staging/gpib/common/gpib_os.c
+++ b/drivers/staging/gpib/common/gpib_os.c
@@ -599,11 +599,9 @@ int ibopen(struct inode *inode, struct file *filep)
GPIB_DPRINTK("pid %i, gpib: opening minor %d\n", current->pid, minor);
if (board->use_count == 0) {
- char module_string[32];
int retval;
- snprintf(module_string, sizeof(module_string), "gpib%i", minor);
- retval = request_module(module_string);
+ retval = request_module("gpib%i", minor);
if (retval) {
GPIB_DPRINTK("pid %i, gpib: request module returned %i\n",
current->pid, retval);
--
2.39.5
next prev parent reply other threads:[~2024-10-16 11:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 11:15 [PATCH 0/7] staging: gpib: randconfig build fixes Arnd Bergmann
2024-10-16 11:15 ` [PATCH 1/7] staging: gpib: add module descriptions Arnd Bergmann
2024-10-16 11:15 ` [PATCH 2/7] staging: gpib: avoid unused const variables Arnd Bergmann
2024-10-16 11:15 ` [PATCH 3/7] staging: gpib: pc2: avoid calling undefined dma_free() Arnd Bergmann
2024-10-16 11:15 ` [PATCH 4/7] staging: gpib: make port I/O code conditional Arnd Bergmann
2024-11-08 19:29 ` Nathan Chancellor
2024-10-16 11:15 ` [PATCH 5/7] staging: gpib: add bus specific Kconfig dependencies Arnd Bergmann
2024-10-16 11:15 ` Arnd Bergmann [this message]
2024-10-16 11:15 ` [PATCH 7/7] staging: gpib: cb7210: select NEC7210 library Arnd Bergmann
2024-10-16 12:33 ` [PATCH 0/7] staging: gpib: randconfig build fixes Dave Penkler
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=20241016111521.1143191-7-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=dpenkler@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
/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