[PATCH] scripts: unifdef: fix stringop-truncation warning

From: Harshit Jain
Date: Fri Aug 17 2018 - 16:20:47 EST


While compiling the mainline kernel in android env with latest gcc 8 the compiler threw this warning Thanks to the advantage of improved static analysis in newer gcc we are now able to
see this warning this patch resolves the detected compiler warnings.

Signed-off-by: Harshit Jain <harshitjain6751@xxxxxxxxx>
---
scripts/unifdef.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 7493c0ee51cc..985649805cdd 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -450,7 +450,7 @@ static void Idrop (void) { Fdrop(); ignoreon(); }
static void Itrue (void) { Ftrue(); ignoreon(); }
static void Ifalse(void) { Ffalse(); ignoreon(); }
/* modify this line */
-static void Mpass (void) { strncpy(keyword, "if ", 4); Pelif(); }
+static void Mpass (void) { memcpy(keyword, "if ", 4); Pelif(); }
static void Mtrue (void) { keywordedit("else"); state(IS_TRUE_MIDDLE); }
static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); }
static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); }
--
2.18.0