diff options
author | Neelesh Gupta <neelegup@linux.vnet.ibm.com> | 2014-03-18 15:45:46 +1100 |
---|---|---|
committer | Eli Qiao <taget@linux.vnet.ibm.com> | 2014-03-19 10:23:05 +0800 |
commit | ee428a2ac3592e73990ac69596f217427c77b91d (patch) | |
tree | be8fe51d93768df0c449ec229571e6affc236330 | |
parent | ed5e5ff37b00e990b4dd92409524f71e4f728757 (diff) | |
download | powerkvm-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.c | 1 |
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)) { |