aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeelesh Gupta <neelegup@linux.vnet.ibm.com>2014-03-18 15:45:46 +1100
committerEli Qiao <taget@linux.vnet.ibm.com>2014-03-19 10:23:05 +0800
commitee428a2ac3592e73990ac69596f217427c77b91d (patch)
treebe8fe51d93768df0c449ec229571e6affc236330
parented5e5ff37b00e990b4dd92409524f71e4f728757 (diff)
downloadpowerkvm-ee428a2ac3592e73990ac69596f217427c77b91d.tar.gz
hwsensors/ibmpowernv: Fix up sysfs file duplication
Fixing up the 'sysfs' file duplication by passing the initialized char array to strncpy() function as the result is not %NUL-terminated if the source exceeds 'copy_length' bytes. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
-rw-r--r--drivers/hwmon/ibmpowernv.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index b7b1297a9b02c5..b9c8a9f4a3d670 100644
--- a/drivers/hwmon/ibmpowernv.c
+++ b/drivers/hwmon/ibmpowernv.c
@@ -199,6 +199,7 @@ static u32 get_sensor_index_from_name(const char *name)
u32 index = 0, copy_length;
char newbuf[8];
+ memset(newbuf, 0, sizeof(newbuf));
if (hash_position) {
copy_length = strchr(hash_position, '-') - hash_position - 1;
if (copy_length < sizeof(newbuf)) {