Commit b0dc512a authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Bjorn Andersson
Browse files

remoteproc: 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 ad67b74d ("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.
There are still a few users of %pK left, but these use it through seq_file,
for which its usage is safe.

Signed-off-by: default avatarThomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://lore.kernel.org/r/20250611-restricted-pointers-remoteproc-v1-1-f059097ba663@linutronix.de


Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent f9262233
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1211,7 +1211,7 @@ static int omap_rproc_of_get_internal_memories(struct platform_device *pdev,
		oproc->mem[i].dev_addr = data->mems[i].dev_addr;
		oproc->mem[i].size = resource_size(res);

		dev_dbg(dev, "memory %8s: bus addr %pa size 0x%x va %pK da 0x%x\n",
		dev_dbg(dev, "memory %8s: bus addr %pa size 0x%x va %p da 0x%x\n",
			data->mems[i].name, &oproc->mem[i].bus_addr,
			oproc->mem[i].size, oproc->mem[i].cpu_addr,
			oproc->mem[i].dev_addr);
+1 −1
Original line number Diff line number Diff line
@@ -1055,7 +1055,7 @@ static int pru_rproc_probe(struct platform_device *pdev)
		pru->mem_regions[i].pa = res->start;
		pru->mem_regions[i].size = resource_size(res);

		dev_dbg(dev, "memory %8s: pa %pa size 0x%zx va %pK\n",
		dev_dbg(dev, "memory %8s: pa %pa size 0x%zx va %p\n",
			mem_names[i], &pru->mem_regions[i].pa,
			pru->mem_regions[i].size, pru->mem_regions[i].va);
	}
+1 −1
Original line number Diff line number Diff line
@@ -699,7 +699,7 @@ static int rproc_alloc_carveout(struct rproc *rproc,
		return -ENOMEM;
	}

	dev_dbg(dev, "carveout va %pK, dma %pad, len 0x%zx\n",
	dev_dbg(dev, "carveout va %p, dma %pad, len 0x%zx\n",
		va, &dma, mem->len);

	if (mem->da != FW_RSC_ADDR_ANY && !rproc->domain) {
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ static struct virtqueue *rp_find_vq(struct virtio_device *vdev,
	size = vring_size(num, rvring->align);
	memset(addr, 0, size);

	dev_dbg(dev, "vring%d: va %pK qsz %d notifyid %d\n",
	dev_dbg(dev, "vring%d: va %p qsz %d notifyid %d\n",
		id, addr, num, rvring->notifyid);

	/*
+1 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ static void *slim_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *
		}
	}

	dev_dbg(&rproc->dev, "da = 0x%llx len = 0x%zx va = 0x%pK\n",
	dev_dbg(&rproc->dev, "da = 0x%llx len = 0x%zx va = 0x%p\n",
		da, len, va);

	return va;
Loading