]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
staging: gpib: use proper format string in request_module
authorArnd Bergmann <arnd@arndb.de>
Wed, 16 Oct 2024 11:15:20 +0000 (11:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 19 Oct 2024 07:57:04 +0000 (09:57 +0200)
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>
Link: https://lore.kernel.org/r/20241016111521.1143191-7-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gpib/common/gpib_os.c

index e93a45132a4098c18808d594af5b4b829b449783..6b12404efe7db98e91ee949c13c275dfc4f6f0e9 100644 (file)
@@ -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);