selftests/powerpc: Fix compile error on tlbie_test due to newer gcc
authorDesnes A. Nunes do Rosario <desnesn@linux.ibm.com>
Thu, 3 Oct 2019 21:10:10 +0000 (18:10 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2019 10:27:55 +0000 (11:27 +0100)
commit3ddf2a70cf6dd7431bbb007158266a28262ce20a
tree2aaa5db413cc525d9cecff49f8d810e31820b781
parente7aaa8dd60c52cbe351c5213a50a92095763268f
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 <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
[sandipan: Backported to v4.19]
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/powerpc/mm/tlbie_test.c