Skip to contentSkip to conversation

drm/rockchip: vop: fix sloppy typing in vop_plane_atomic_update()

PATCH In review Sergey Shtylyov 1 participant 2 messages Feb 6

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

PATCH 1/1 drm/rockchip: vop: fix sloppy typing in vop_plane_atomic_update()

In vop_plane_atomic_update(), the variable offset is needlessly typed as *unsigned long* -- which is 32-bit type on the 32-bit arches and 64-bit type on the 64-bit arches. I highly doubt that this variable can exceed 4 GiB even on 64-bit arches, so let's redeclare it as *unsigned int*...

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
index 1b466623b6c7..ee53755751ac 100644
@@ -924,7 +924,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	struct drm_rect *dest = &new_state->dst;
 	struct drm_gem_object *obj, *uv_obj;
 	struct rockchip_gem_object *rk_obj, *rk_uv_obj;
-	unsigned long offset;
+	unsigned int offset;
 	dma_addr_t dma_addr;
 	uint32_t val;
 	bool rb_swap, uv_swap;
Signature · 7 lines
2.52.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#1 lore raw
Quoted 9 lines · Sergey Shtylyov

In vop_plane_atomic_update(), the variable offset is needlessly typed as *unsigned long* -- which is 32-bit type on the 32-bit arches and 64-bit type on the 64-bit arches. I highly doubt that this variable can exceed 4 GiB even on 64-bit arches, so let's redeclare it as *unsigned int*...

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

Oops, I did forget to add that the patch is against the drm-misc-next branch
of the drm/misc/kernel.git repo on gitlab.freedesktop.org.

MBR, Sergey

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip