]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
target: change sprintf to snprintf in transport_dump_vpd_ident
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 18 Jan 2013 13:05:12 +0000 (16:05 +0300)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 13 Feb 2013 19:27:31 +0000 (11:27 -0800)
"buf" is 128 characters and "vpd->device_identifier" is 256.  It makes
the static checkers complain.

Also bump VPD_TMP_BUF_SIZE to match INQUIRY_VPD_DEVICE_IDENTIFIER_LEN.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_transport.c
include/target/target_core_base.h

index bd587b70661a0ce11f6aaab596f4e46c6ee14c7e..96b64d57ebbb9f0180ace4f2dc0b3e6f5dd1e3b8 100644 (file)
@@ -907,15 +907,18 @@ int transport_dump_vpd_ident(
 
        switch (vpd->device_identifier_code_set) {
        case 0x01: /* Binary */
-               sprintf(buf, "T10 VPD Binary Device Identifier: %s\n",
+               snprintf(buf, sizeof(buf),
+                       "T10 VPD Binary Device Identifier: %s\n",
                        &vpd->device_identifier[0]);
                break;
        case 0x02: /* ASCII */
-               sprintf(buf, "T10 VPD ASCII Device Identifier: %s\n",
+               snprintf(buf, sizeof(buf),
+                       "T10 VPD ASCII Device Identifier: %s\n",
                        &vpd->device_identifier[0]);
                break;
        case 0x03: /* UTF-8 */
-               sprintf(buf, "T10 VPD UTF-8 Device Identifier: %s\n",
+               snprintf(buf, sizeof(buf),
+                       "T10 VPD UTF-8 Device Identifier: %s\n",
                        &vpd->device_identifier[0]);
                break;
        default:
index 4fa0f1038360dbf27e1d4840ccbeffc760edf1e2..199b0ad1a55ebd35268befd6c884b41da88bff5b 100644 (file)
@@ -44,7 +44,7 @@
 /* Used by core_alua_store_tg_pt_gp_info() and target_core_alua_tg_pt_gp_show_attr_members() */
 #define TG_PT_GROUP_NAME_BUF                   256
 /* Used to parse VPD into struct t10_vpd */
-#define VPD_TMP_BUF_SIZE                       128
+#define VPD_TMP_BUF_SIZE                       254
 /* Used by transport_generic_cmd_sequencer() */
 #define READ_BLOCK_LEN                         6
 #define READ_CAP_LEN                           8