[PATCH] scsi: ibmvscsi: ibmvstgt.c: Cleaning up missing null-terminate in conjunction with strncpy

From: Rickard Strandqvist
Date: Sat Aug 02 2014 - 19:22:35 EST


Replacing strncpy with strlcpy to avoid strings that lacks null terminate.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
---
drivers/scsi/ibmvscsi/ibmvstgt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index 56f8a86..5c16d17 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -340,7 +340,7 @@ int send_adapter_info(struct iu_entry *iue,
memset(info, 0, sizeof(*info));

strcpy(info->srp_version, "16.a");
- strncpy(info->partition_name, partition_name,
+ strlcpy(info->partition_name, partition_name,
sizeof(info->partition_name));
info->partition_number = partition_number;
info->mad_version = 1;
@@ -938,7 +938,7 @@ static int get_system_info(void)

name = of_get_property(rootdn, "ibm,partition-name", NULL);
if (name)
- strncpy(partition_name, name, sizeof(partition_name));
+ strlcpy(partition_name, name, sizeof(partition_name));

num = of_get_property(rootdn, "ibm,partition-no", NULL);
if (num)
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/