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: <17439351.R8V0LkWGHs@daeseok-laptop.cloud.net>
Date:	Fri, 14 Mar 2014 18:08:43 +0900
From:	Daeseok Youn <daeseok.youn@...il.com>
To:	gregkh@...uxfoundation.org
Cc:	sachin.kamat@...aro.org, shaun@...source.ca,
	dulshani.gunawardhana89@...il.com, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] staging: cxt1e1: remove redundant memset() call


The banner array doens't need to set to 0.
sprintf() adds a terminating '\0'.

And the sn array can be declared and initialized to zero.
So remove redundant memset() with zero.

Remove unnecessary cast for memcpy().

Signed-off-by: Daeseok Youn <daeseok.youn@...il.com>
---
 drivers/staging/cxt1e1/hwprobe.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index d87a011..d41fb79 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -51,22 +51,16 @@ show_two(hdw_info_t *hi, int brdno)
 	struct pci_dev *pdev;
 	char       *bid;
 	char       banner[80];
-	char	sn[6];
-
-	/* clear print buffer */
-	memset(banner, 0, 80);
+	char	sn[6] = {0,};
 
 	ci = (ci_t *)(netdev_priv(hi->ndev));
 	bid = sbeid_get_bdname(ci);
 	switch (hi->promfmt) {
 	case PROM_FORMAT_TYPE1:
-		memcpy(sn, (FLD_TYPE1 *)(hi->mfg_info.pft1.Serial), 6);
+		memcpy(sn, hi->mfg_info.pft1.Serial, 6);
 		break;
 	case PROM_FORMAT_TYPE2:
-		memcpy(sn, (FLD_TYPE2 *)(hi->mfg_info.pft2.Serial), 6);
-		break;
-	default:
-		memset(sn, 0, 6);
+		memcpy(sn, hi->mfg_info.pft2.Serial, 6);
 		break;
 	}
 
-- 
1.7.4.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