aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/coco/tdx/tdx.c
diff options
context:
space:
mode:
authorGravatar Justin Stitt <justinstitt@google.com> 2023-10-03 21:54:59 +0000
committerGravatar Ingo Molnar <mingo@kernel.org> 2023-10-04 09:34:07 +0200
commitc9babd5d95abf3fae6e798605ce5cac98e08daf9 (patch)
tree295e8d711a50c0c07961744df07338f7ea78a081 /arch/x86/coco/tdx/tdx.c
parentselftests/x86/mm: Add new test that userspace stack is in fact NX (diff)
downloadlinux-c9babd5d95abf3fae6e798605ce5cac98e08daf9.tar.gz
linux-c9babd5d95abf3fae6e798605ce5cac98e08daf9.tar.bz2
linux-c9babd5d95abf3fae6e798605ce5cac98e08daf9.zip
x86/tdx: Replace deprecated strncpy() with strtomem_pad()
strncpy() works perfectly here in all cases, however, it is deprecated and as such we should prefer more robust and less ambiguous string APIs: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings Let's use strtomem_pad() as this matches the functionality of strncpy() and is _not_ deprecated. Signed-off-by: Justin Stitt <justinstitt@google.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://github.com/KSPP/linux/issues/90 Link: https://lore.kernel.org/r/20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com
Diffstat (limited to 'arch/x86/coco/tdx/tdx.c')
-rw-r--r--arch/x86/coco/tdx/tdx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index 1d6b863c42b0..2e1be592c220 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -119,7 +119,7 @@ static void __noreturn tdx_panic(const char *msg)
} message;
/* VMM assumes '\0' in byte 65, if the message took all 64 bytes */
- strncpy(message.str, msg, 64);
+ strtomem_pad(message.str, msg, '\0');
args.r8 = message.r8;
args.r9 = message.r9;