From 003f144ca04621e598fc1c5c4ce0a851cddfe104 Mon Sep 17 00:00:00 2001 From: Ruben Wauters Date: Wed, 30 Apr 2025 00:03:59 +0100 Subject: [PATCH 1/3] x86/CPU/AMD: Replace strcpy() with strscpy() strcpy() is deprecated due to issues with bounds checking and overflows. Replace it with strscpy(). Signed-off-by: Ruben Wauters Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/20250429230710.54014-1-rubenru09@aol.com --- arch/x86/kernel/cpu/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 2b36379ff675..0feb717a3624 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -643,7 +643,7 @@ static void init_amd_k8(struct cpuinfo_x86 *c) } if (!c->x86_model_id[0]) - strcpy(c->x86_model_id, "Hammer"); + strscpy(c->x86_model_id, "Hammer"); #ifdef CONFIG_SMP /* From bd6afa43eee175ba146f6f9a27d6d24eeaab0a45 Mon Sep 17 00:00:00 2001 From: Shivank Garg Date: Wed, 14 May 2025 06:26:40 +0000 Subject: [PATCH 2/3] x86/mm/pat: Fix W=1 build kernel-doc warning Building the kernel with W=1 generates the following warning: arch/x86/mm/pat/memtype.c:692: warning: Function parameter or struct member 'pfn' not described in 'pat_pfn_immune_to_uc_mtrr' Add missing parameter documentation to fix the kernel-doc warning. Signed-off-by: Shivank Garg Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20250514062637.3287779-3-shivankg@amd.com --- arch/x86/mm/pat/memtype.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c index 72d8cbc61158..51635ae1eb7f 100644 --- a/arch/x86/mm/pat/memtype.c +++ b/arch/x86/mm/pat/memtype.c @@ -682,6 +682,7 @@ static enum page_cache_mode lookup_memtype(u64 paddr) /** * pat_pfn_immune_to_uc_mtrr - Check whether the PAT memory type * of @pfn cannot be overridden by UC MTRR memory type. + * @pfn: The page frame number to check. * * Only to be called when PAT is enabled. * From f449bf98b7b63702e86155fe5fa3c853c3bf1fda Mon Sep 17 00:00:00 2001 From: Shivank Garg Date: Wed, 14 May 2025 06:26:38 +0000 Subject: [PATCH 3/3] x86/power: hibernate: Fix W=1 build kernel-doc warnings Warnings generated with 'make W=1': arch/x86/power/hibernate.c:47: warning: Function parameter or struct member 'pfn' not described in 'pfn_is_nosave' arch/x86/power/hibernate.c:92: warning: Function parameter or struct member 'max_size' not described in 'arch_hibernation_header_save' Add missing parameter documentation in hibernate functions to fix kernel-doc warnings. Signed-off-by: Shivank Garg Signed-off-by: Ingo Molnar Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20250514062637.3287779-2-shivankg@amd.com --- arch/x86/power/hibernate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/power/hibernate.c b/arch/x86/power/hibernate.c index 5b81d19cd114..a7c23f2a58c9 100644 --- a/arch/x86/power/hibernate.c +++ b/arch/x86/power/hibernate.c @@ -42,6 +42,7 @@ unsigned long relocated_restore_code __visible; /** * pfn_is_nosave - check if given pfn is in the 'nosave' section + * @pfn: the page frame number to check. */ int pfn_is_nosave(unsigned long pfn) { @@ -86,7 +87,10 @@ static inline u32 compute_e820_crc32(struct e820_table *table) /** * arch_hibernation_header_save - populate the architecture specific part * of a hibernation image header - * @addr: address to save the data at + * @addr: address where architecture specific header data will be saved. + * @max_size: maximum size of architecture specific data in hibernation header. + * + * Return: 0 on success, -EOVERFLOW if max_size is insufficient. */ int arch_hibernation_header_save(void *addr, unsigned int max_size) {