Skip to content

Commit 879d09b

Browse files
Desnes A. Nunes do Rosariogregkh
authored andcommitted
selftests/powerpc: Fix compile error on tlbie_test due to newer gcc
commit 5b216ea 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 <desnesn@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20191003211010.9711-1-desnesn@linux.ibm.com Signed-off-by: Sandipan Das <sandipan@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c3dbb31 commit 879d09b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tools/testing/selftests/powerpc/mm/tlbie_test.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ int main(int argc, char *argv[])
636636
nrthreads = strtoul(optarg, NULL, 10);
637637
break;
638638
case 'l':
639-
strncpy(logdir, optarg, LOGDIR_NAME_SIZE);
639+
strncpy(logdir, optarg, LOGDIR_NAME_SIZE - 1);
640640
break;
641641
case 't':
642642
run_time = strtoul(optarg, NULL, 10);

0 commit comments

Comments
 (0)