selftests/x86/lam: Zero out buffer for readlink()
authorBinbin Wu <binbin.wu@linux.intel.com>
Mon, 16 Oct 2023 06:24:46 +0000 (14:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:58:54 +0000 (11:58 +0100)
commitb13513e7641c8493964793d2b73b728df666c5c1
tree003a49e752813259e718ea4195824649be1518ef
parentb0ebeb5956e5eae19c1520fb78197a252aabc4c3
selftests/x86/lam: Zero out buffer for readlink()

[ Upstream commit 29060633411a02f6f2dd9d5245919385d69d81f0 ]

Zero out the buffer for readlink() since readlink() does not append a
terminating null byte to the buffer.  Also change the buffer length
passed to readlink() to 'PATH_MAX - 1' to ensure the resulting string
is always null terminated.

Fixes: 833c12ce0f430 ("selftests/x86/lam: Add inherit test cases for linear-address masking")
Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Link: https://lore.kernel.org/r/20231016062446.695-1-binbin.wu@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/x86/lam.c