Skip to content

Commit 93b17c6

Browse files
t-8chgregkh
authored andcommitted
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 ad67b74 ("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 <[email protected]> Link: https://lore.kernel.org/r/20250718-restricted-pointers-virt-v1-1-12913fceaf52@linutronix.de Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a6d283c commit 93b17c6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/virt/acrn/ioreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ int acrn_ioreq_init(struct acrn_vm *vm, u64 buf_vma)
626626
}
627627

628628
dev_dbg(acrn_dev.this_device,
629-
"Init ioreq buffer %pK!\n", vm->ioreq_buf);
629+
"Init ioreq buffer %p!\n", vm->ioreq_buf);
630630
ret = 0;
631631
free_buf:
632632
kfree(set_buffer);
@@ -638,7 +638,7 @@ void acrn_ioreq_deinit(struct acrn_vm *vm)
638638
struct acrn_ioreq_client *client, *next;
639639

640640
dev_dbg(acrn_dev.this_device,
641-
"Deinit ioreq buffer %pK!\n", vm->ioreq_buf);
641+
"Deinit ioreq buffer %p!\n", vm->ioreq_buf);
642642
/* Destroy all clients belonging to this VM */
643643
list_for_each_entry_safe(client, next, &vm->ioreq_clients, list)
644644
acrn_ioreq_client_destroy(client);

drivers/virt/acrn/mm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int acrn_mm_region_add(struct acrn_vm *vm, u64 user_gpa, u64 service_gpa,
6868
ret = modify_region(vm, region);
6969

7070
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",
7272
__func__, (void *)user_gpa, (void *)service_gpa, size);
7373
kfree(region);
7474
return ret;
@@ -99,7 +99,7 @@ int acrn_mm_region_del(struct acrn_vm *vm, u64 user_gpa, u64 size)
9999

100100
ret = modify_region(vm, region);
101101

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",
103103
__func__, (void *)user_gpa, size);
104104
kfree(region);
105105
return ret;
@@ -224,7 +224,7 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap)
224224

225225
if (ret) {
226226
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);
228228
return ret;
229229
}
230230

@@ -326,7 +326,7 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap)
326326
kfree(regions_info);
327327

328328
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",
330330
__func__, vm->vmid,
331331
remap_vaddr, (void *)memmap->user_vm_pa, memmap->len);
332332
return ret;

0 commit comments

Comments
 (0)