]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: target: iscsi: Initialize arrays at declaration time
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Sun, 28 Feb 2021 05:56:34 +0000 (21:56 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 10 Mar 2021 04:47:18 +0000 (23:47 -0500)
Avoids calling memset().

Link: https://lore.kernel.org/r/20210228055645.22253-13-chaitanya.kulkarni@wdc.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/iscsi/iscsi_target_configfs.c

index 0fa1d57b26fa8546277a5ff0e5719b34033dae2f..f4a24fa5058e6534feec1da9ae701fe3a10f4411 100644 (file)
@@ -161,14 +161,13 @@ static struct se_tpg_np *lio_target_call_addnptotpg(
        char *str, *str2, *ip_str, *port_str;
        struct sockaddr_storage sockaddr = { };
        int ret;
-       char buf[MAX_PORTAL_LEN + 1];
+       char buf[MAX_PORTAL_LEN + 1] = { };
 
        if (strlen(name) > MAX_PORTAL_LEN) {
                pr_err("strlen(name): %d exceeds MAX_PORTAL_LEN: %d\n",
                        (int)strlen(name), MAX_PORTAL_LEN);
                return ERR_PTR(-EOVERFLOW);
        }
-       memset(buf, 0, MAX_PORTAL_LEN + 1);
        snprintf(buf, MAX_PORTAL_LEN + 1, "%s", name);
 
        str = strstr(buf, "[");