[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20201112095715.1993117-4-lee.jones@linaro.org>
Date: Thu, 12 Nov 2020 09:57:15 +0000
From: Lee Jones <lee.jones@...aro.org>
To: jdelvare@...e.com, linux@...ck-us.net
Cc: linux-kernel@...r.kernel.org, linux-hwmon@...r.kernel.org,
Lee Jones <lee.jones@...aro.org>,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Neelesh Gupta <neelegup@...ux.vnet.ibm.com>,
linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH 3/3] 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 <jdelvare@...e.com>
Cc: Guenter Roeck <linux@...ck-us.net>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Neelesh Gupta <neelegup@...ux.vnet.ibm.com>
Cc: linux-hwmon@...r.kernel.org
Cc: linuxppc-dev@...ts.ozlabs.org
Signed-off-by: Lee Jones <lee.jones@...aro.org>
---
drivers/hwmon/ibmpowernv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index a750647e66a47..8e3724728cce0 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;
}
--
2.25.1
Powered by blists - more mailing lists