Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Don't use %pK through printk

Restricted pointers ("%pK") are not meant to be used through printk().
It can unintentionally expose security sensitive, raw pointer values.

Use regular pointer formatting instead.

Link: https://lore.kernel.org/lkml/20250113171731-dc10e3c1-da64-4af0-b767-7c7070468023@linutronix.de/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Thomas Weißschuh and committed by
Thomas Bogendoerfer
3ebcbf07 748f8b27

+7 -7
+5 -5
arch/mips/kernel/relocate.c
··· 138 138 apply_r_mips_hi16_rel(loc_orig, loc_new, offset); 139 139 break; 140 140 default: 141 - pr_err("Unhandled relocation type %d at 0x%pK\n", type, 141 + pr_err("Unhandled relocation type %d at 0x%p\n", type, 142 142 loc_orig); 143 143 return -ENOEXEC; 144 144 } ··· 439 439 { 440 440 if (__kaslr_offset > 0) { 441 441 printk(level); 442 - pr_cont("Kernel relocated by 0x%pK\n", (void *)__kaslr_offset); 443 - pr_cont(" .text @ 0x%pK\n", _text); 444 - pr_cont(" .data @ 0x%pK\n", _sdata); 445 - pr_cont(" .bss @ 0x%pK\n", __bss_start); 442 + pr_cont("Kernel relocated by 0x%p\n", (void *)__kaslr_offset); 443 + pr_cont(" .text @ 0x%p\n", _text); 444 + pr_cont(" .data @ 0x%p\n", _sdata); 445 + pr_cont(" .bss @ 0x%p\n", __bss_start); 446 446 } 447 447 } 448 448
+1 -1
arch/mips/kvm/mips.c
··· 315 315 * we allocate is out of range, just give up now. 316 316 */ 317 317 if (!cpu_has_ebase_wg && virt_to_phys(gebase) >= 0x20000000) { 318 - kvm_err("CP0_EBase.WG required for guest exception base %pK\n", 318 + kvm_err("CP0_EBase.WG required for guest exception base %p\n", 319 319 gebase); 320 320 err = -ENOMEM; 321 321 goto out_free_gebase;
+1 -1
arch/mips/mm/physaddr.c
··· 30 30 phys_addr_t __virt_to_phys(volatile const void *x) 31 31 { 32 32 WARN(!__debug_virt_addr_valid((unsigned long)x), 33 - "virt_to_phys used for non-linear address: %pK (%pS)\n", 33 + "virt_to_phys used for non-linear address: %p (%pS)\n", 34 34 x, x); 35 35 36 36 return __virt_to_phys_nodebug(x);