lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1410710401-14241-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date:	Sun, 14 Sep 2014 18:00:01 +0200
From:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To:	Mike Miller <mike.miller@...com>, iss_storagedev@...com
Cc:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] block: cciss.c:  Cleaning up unnecessary use of memset in conjunction with strncpy

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@...ctrumdigital.se>
---
 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ