diff mbox series

drm: cast calculation to __u64 in qxl_mode_dumb_create()

Message ID 20241125172516.9622-1-zichenxie0106@gmail.com (mailing list archive)
State New
Headers show
Series drm: cast calculation to __u64 in qxl_mode_dumb_create() | expand

Commit Message

Gax-c Nov. 25, 2024, 5:25 p.m. UTC
From: Zichen Xie <zichenxie0106@gmail.com>

Like commit b0b0d811eac6 ("drm/mediatek: Fix coverity issue with
unintentional integer overflow"), directly multiply pitch and
args->height may lead to integer overflow. Add a cast to avoid it.

Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
---
 drivers/gpu/drm/qxl/qxl_dumb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/qxl/qxl_dumb.c b/drivers/gpu/drm/qxl/qxl_dumb.c
index 17df5c7ccf69..74076c87a002 100644
--- a/drivers/gpu/drm/qxl/qxl_dumb.c
+++ b/drivers/gpu/drm/qxl/qxl_dumb.c
@@ -41,7 +41,7 @@  int qxl_mode_dumb_create(struct drm_file *file_priv,
 	uint32_t pitch, format;
 
 	pitch = args->width * ((args->bpp + 1) / 8);
-	args->size = pitch * args->height;
+	args->size = (__u64)pitch * args->height;
 	args->size = ALIGN(args->size, PAGE_SIZE);
 
 	switch (args->bpp) {