Skip to content

Commit 3ebcbf0

Browse files
t-8chtsbogend
authored andcommitted
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 <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 748f8b2 commit 3ebcbf0

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

arch/mips/kernel/relocate.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static int __init reloc_handler(u32 type, u32 *loc_orig, u32 *loc_new,
138138
apply_r_mips_hi16_rel(loc_orig, loc_new, offset);
139139
break;
140140
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,
142142
loc_orig);
143143
return -ENOEXEC;
144144
}
@@ -439,10 +439,10 @@ static void show_kernel_relocation(const char *level)
439439
{
440440
if (__kaslr_offset > 0) {
441441
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);
446446
}
447447
}
448448

arch/mips/kvm/mips.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
315315
* we allocate is out of range, just give up now.
316316
*/
317317
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",
319319
gebase);
320320
err = -ENOMEM;
321321
goto out_free_gebase;

arch/mips/mm/physaddr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static inline bool __debug_virt_addr_valid(unsigned long x)
3030
phys_addr_t __virt_to_phys(volatile const void *x)
3131
{
3232
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",
3434
x, x);
3535

3636
return __virt_to_phys_nodebug(x);

0 commit comments

Comments
 (0)