[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1410710532-14429-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date: Sun, 14 Sep 2014 18:02:12 +0200
From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To: "James E.J. Bottomley" <jejb@...isc-linux.org>,
Helge Deller <deller@....de>
Cc: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
linux-parisc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] parisc: pdc_stable.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/parisc/pdc_stable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 0f54ab6..76860ad 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -765,8 +765,8 @@ static ssize_t pdcs_auto_write(struct kobject *kobj,
return -EINVAL;
/* We'll use a local copy of buf */
- memset(in, 0, count+1);
strncpy(in, buf, count);
+ in[count] = '\0';
/* Current flags are stored in primary boot path entry */
pathentry = &pdcspath_entry_primary;
--
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