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

drivers: virt: acrn: Don't use %pK through printk

In the past %pK was preferable to %p as it would not leak raw pointer
values into the kernel log.
Since commit ad67b74d2469 ("printk: hash addresses printed with %p")
the regular %p has been improved to avoid this issue.
Furthermore, restricted pointers ("%pK") were never meant to be used
through printk(). They can still unintentionally leak raw pointers or
acquire sleeping locks in atomic contexts.

Switch to the regular pointer formatting which is safer and
easier to reason about.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://lore.kernel.org/r/20250718-restricted-pointers-virt-v1-1-12913fceaf52@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
93b17c6a a6d283c5

+6 -6
+2 -2
drivers/virt/acrn/ioreq.c
··· 626 626 } 627 627 628 628 dev_dbg(acrn_dev.this_device, 629 - "Init ioreq buffer %pK!\n", vm->ioreq_buf); 629 + "Init ioreq buffer %p!\n", vm->ioreq_buf); 630 630 ret = 0; 631 631 free_buf: 632 632 kfree(set_buffer); ··· 638 638 struct acrn_ioreq_client *client, *next; 639 639 640 640 dev_dbg(acrn_dev.this_device, 641 - "Deinit ioreq buffer %pK!\n", vm->ioreq_buf); 641 + "Deinit ioreq buffer %p!\n", vm->ioreq_buf); 642 642 /* Destroy all clients belonging to this VM */ 643 643 list_for_each_entry_safe(client, next, &vm->ioreq_clients, list) 644 644 acrn_ioreq_client_destroy(client);
+4 -4
drivers/virt/acrn/mm.c
··· 68 68 ret = modify_region(vm, region); 69 69 70 70 dev_dbg(acrn_dev.this_device, 71 - "%s: user-GPA[%pK] service-GPA[%pK] size[0x%llx].\n", 71 + "%s: user-GPA[%p] service-GPA[%p] size[0x%llx].\n", 72 72 __func__, (void *)user_gpa, (void *)service_gpa, size); 73 73 kfree(region); 74 74 return ret; ··· 99 99 100 100 ret = modify_region(vm, region); 101 101 102 - dev_dbg(acrn_dev.this_device, "%s: user-GPA[%pK] size[0x%llx].\n", 102 + dev_dbg(acrn_dev.this_device, "%s: user-GPA[%p] size[0x%llx].\n", 103 103 __func__, (void *)user_gpa, size); 104 104 kfree(region); 105 105 return ret; ··· 224 224 225 225 if (ret) { 226 226 dev_dbg(acrn_dev.this_device, 227 - "Failed to lookup PFN at VMA:%pK.\n", (void *)memmap->vma_base); 227 + "Failed to lookup PFN at VMA:%p.\n", (void *)memmap->vma_base); 228 228 return ret; 229 229 } 230 230 ··· 326 326 kfree(regions_info); 327 327 328 328 dev_dbg(acrn_dev.this_device, 329 - "%s: VM[%u] service-GVA[%pK] user-GPA[%pK] size[0x%llx]\n", 329 + "%s: VM[%u] service-GVA[%p] user-GPA[%p] size[0x%llx]\n", 330 330 __func__, vm->vmid, 331 331 remap_vaddr, (void *)memmap->user_vm_pa, memmap->len); 332 332 return ret;