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/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 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel