Skip to contentSkip to conversation

video: fbdev: fix the out-of-bounds access cr_data->bak

PATCH New Wenjia Zhao 1 participant 1 message Feb 1, 2021

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

PATCH 3/3 video: fbdev: fix the out-of-bounds access cr_data->bak

The size of cr_data->bak is CURSOR_SIZE/4, however the access size in the is
CURSOR_SIZE in the loop. It causes the out-of-bounds access.

---
 drivers/video/fbdev/via/viafbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/via/viafbdev.c +1 -1
index 22deb34..ef217cc 100644
@@ -839,7 +839,7 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 	if (cursor->set & FB_CUR_SETSHAPE) {
 		struct {
 			u8 data[CURSOR_SIZE];
-			u32 bak[CURSOR_SIZE / 4];
+			u32 bak[CURSOR_SIZE];
 		} *cr_data = kzalloc(sizeof(*cr_data), GFP_ATOMIC);
 		int size = ((cursor->image.width + 7) >> 3) *
 			cursor->image.height;
Signature · 1 line
2.7.4