[PATCH] block: cciss.c: Cleaning up unnecessary use of memset in conjunction with strncpy

From: Rickard Strandqvist
Date: Sun Sep 14 2014 - 11:58:29 EST


Using memset before strncpy just to ensure a trailing null
character is an unnecessary double writing of a string

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
---
drivers/block/cciss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index ff20f19..f892618 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4580,8 +4580,8 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,

static void init_driver_version(char *driver_version, int len)
{
- memset(driver_version, 0, len);
strncpy(driver_version, "cciss " DRIVER_NAME, len - 1);
+ driver_version[len - 1] = '\0';
}

static int write_driver_ver_to_cfgtable(CfgTable_struct __iomem *cfgtable)
--
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/