diff options
author | Lee Jones <[email protected]> | 2020-11-12 09:57:15 +0000 |
---|---|---|
committer | Guenter Roeck <[email protected]> | 2020-12-02 17:42:23 -0800 |
commit | 66d5b034ea5cc617a402c5d81f56c22aa85a801f (patch) | |
tree | e7add3c3cf61c58cb7a8584ea1c00b5eafed87d6 | |
parent | f9279cdaa69f96dd04ad644e2713abdee606d05d (diff) |
hwmon: (ibmpowernv) Silence strncpy() warning
Fixes the following W=1 kernel build warning(s):
from drivers/hwmon/ibmpowernv.c:11:
In function ‘strncpy’,
inlined from ‘get_sensor_index_attr’ at drivers/hwmon/ibmpowernv.c:243:2,
inlined from ‘create_device_attrs’ at drivers/hwmon/ibmpowernv.c:280:8:
include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
297 | #define __underlying_strncpy __builtin_strncpy
| ^
include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
307 | return __underlying_strncpy(p, q, size);
| ^~~~~~~~~~~~~~~~~~~~
Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Neelesh Gupta <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Lee Jones <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
-rw-r--r-- | drivers/hwmon/ibmpowernv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c index a750647e66a4..8e3724728cce 100644 --- a/drivers/hwmon/ibmpowernv.c +++ b/drivers/hwmon/ibmpowernv.c @@ -240,7 +240,7 @@ static int get_sensor_index_attr(const char *name, u32 *index, char *attr) if (err) return err; - strncpy(attr, dash_pos + 1, MAX_ATTR_LEN); + strscpy(attr, dash_pos + 1, MAX_ATTR_LEN); return 0; } |