blob: 72f696358d1325ab2e1954b1c0013d82e2e11cb7 [file] [log] [blame]
From 8c9d7d01ccf001fea2bf6168b20c6666d8099ab7 Mon Sep 17 00:00:00 2001
From: "Desnes A. Nunes do Rosario" <>
Date: Thu, 3 Oct 2019 18:10:10 -0300
Subject: [PATCH] selftests/powerpc: Fix compile error on tlbie_test due to
newer gcc
commit 5b216ea1c40cf06eead15054c70e238c9bd4729e upstream.
Newer versions of GCC (>= 9) demand that the size of the string to be
copied must be explicitly smaller than the size of the destination.
Thus, the NULL char has to be taken into account on strncpy.
This will avoid the following compiling error:
tlbie_test.c: In function 'main':
tlbie_test.c:639:4: error: 'strncpy' specified bound 100 equals destination size
strncpy(logdir, optarg, LOGDIR_NAME_SIZE);
cc1: all warnings being treated as errors
Signed-off-by: Desnes A. Nunes do Rosario <>
Signed-off-by: Michael Ellerman <>
Signed-off-by: Paul Gortmaker <>
diff --git a/tools/testing/selftests/powerpc/mm/tlbie_test.c b/tools/testing/selftests/powerpc/mm/tlbie_test.c
index 9868a5ddd847..f85a0938ab25 100644
--- a/tools/testing/selftests/powerpc/mm/tlbie_test.c
+++ b/tools/testing/selftests/powerpc/mm/tlbie_test.c
@@ -636,7 +636,7 @@ int main(int argc, char *argv[])
nrthreads = strtoul(optarg, NULL, 10);
case 'l':
- strncpy(logdir, optarg, LOGDIR_NAME_SIZE);
+ strncpy(logdir, optarg, LOGDIR_NAME_SIZE - 1);
case 't':
run_time = strtoul(optarg, NULL, 10);