[PATCH] drm: Shift wrap bug in create_in_format_blob()
Dan Carpenter
dan.carpenter at oracle.com
Wed Aug 9 11:19:06 UTC 2017
"plane->format_count" can go up to 64. (It's capped in
drm_universal_plane_init().) So we should be using ULL type instead of
int here to prevent shift wrapping.
Fixes: db1689aa61bd ("drm: Create a format/modifier blob")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 5c14beee52ff..85ab1eec73e5 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -126,7 +126,7 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
plane->format_types[j],
plane->modifiers[i])) {
- mod->formats |= 1 << j;
+ mod->formats |= 1ULL << j;
}
}
More information about the dri-devel
mailing list