[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1410710661-14604-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date: Sun, 14 Sep 2014 18:04:21 +0200
From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: Matt Kurz <matt@...ezulu.com>,
Vitaly Osipov <vitaly.osipov@...il.com>,
Tugce Sirin <ztugcesirin@...il.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: wlan-ng: prism2fw.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/staging/wlan-ng/prism2fw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index 42c14b0..e66b7d4 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -733,8 +733,8 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
c, chunkoff);
if (j == -1) { /* plug the filename */
- memset(dest, 0, s3plug[i].len);
strncpy(dest, PRISM2_USB_FWFILE, s3plug[i].len - 1);
+ dest[s3plug[i].len - 1] = '\0';
} else { /* plug a PDR */
memcpy(dest, &(pda->rec[j]->data), s3plug[i].len);
}
--
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