]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
iscsi-target: Fix snprintf usage with MAX_PORTAL_LEN
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 27 Jul 2011 19:37:03 +0000 (12:37 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 27 Jul 2011 20:28:38 +0000 (20:28 +0000)
This patch makes lio_target_call_addnptotpg() use sprintf() with
MAX_PORTAL_LEN + 1 to address the following smatch warning:

drivers/target/iscsi/iscsi_target_configfs.c +184 lio_target_call_addnptotpg(21)
        error: snprintf() chops off the last chars of 'name': 257 vs 256

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/iscsi/iscsi_target_configfs.c

index 32bb92c44450bb4eeebc34ebe73fa391233d72de..f095e65b1ccf401a2a4b951d5e8c463827dcc57f 100644 (file)
@@ -181,7 +181,7 @@ struct se_tpg_np *lio_target_call_addnptotpg(
                return ERR_PTR(-EOVERFLOW);
        }
        memset(buf, 0, MAX_PORTAL_LEN + 1);
-       snprintf(buf, MAX_PORTAL_LEN, "%s", name);
+       snprintf(buf, MAX_PORTAL_LEN + 1, "%s", name);
 
        memset(&sockaddr, 0, sizeof(struct __kernel_sockaddr_storage));