Skip to contentSkip to conversation

drm/msm/dpu: Don't use %pK through printk (again)

PATCH Applied Thomas Weißschuh 2 participants 3 messages Feb 23 – Feb 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dpu: Don't use %pK through printk (again)

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.

This was previously fixed in this driver in commit 1ba9fbe40337 ("drm/msm: Don't use %pK through printk") but an additional usage was reintroduced in commit 39a750ff5fc9 ("drm/msm/dpu: Add DSPP GC driver to provide GAMMA_LUT DRM property")

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c +1 -1
index 188ee0af2c90..23dcbe1ce1b8 100644
@@ -89,7 +89,7 @@ static void dpu_setup_dspp_gc(struct dpu_hw_dspp *ctx,
 	base = ctx->cap->sblk->gc.base;
 
 	if (!base) {
-		DRM_ERROR("invalid ctx %pK gc base\n", ctx);
+		DRM_ERROR("invalid ctx %p gc base\n", ctx);
 		return;
 	}
 

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260223-restricted-pointers-msm-d6af3dbf14b6

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Thomas Weißschuh

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.

This was previously fixed in this driver in commit 1ba9fbe40337 ("drm/msm: Don't use %pK through printk") but an additional usage was reintroduced in commit 39a750ff5fc9 ("drm/msm/dpu: Add DSPP GC driver to provide GAMMA_LUT DRM property")

Quoted 4 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Fixes 39a750ff5fc9 ("drm/msm/dpu: Add DSPP GC driver to provide GAMMA_LUT DRM property")
Signature · 2 lines
With best wishes
Dmitry
#2 lore raw
In reply to Thomas Weißschuh
Quoted 9 lines · Thomas Weißschuh

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.

[...]

Applied to msm-fixes, thanks!

[1/1] drm/msm/dpu: Don't use %pK through printk (again)

      https://gitlab.freedesktop.org/lumag/msm/-/commit/5886cc8f895b

Best regards,

Signature · 2 lines
With best wishes
Dmitry