Skip to contentSkip to conversation

video: fbdev: pxafb: zero allocated memory for video modes

PATCH In review Daniel Mack 3 participants 6 messages Jun 19, 2018 – Jun 24, 2018 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 video: fbdev: pxafb: zero allocated memory for video modes

When parsing the video modes from DT properties, make sure to zero out memory befor using it. This is important because not all fields in the mode struct are explicitly initialized, even though they are used later on.

Fixes 420a488278e86 (video: fbdev: pxafb: initial devicetree conversion)
Cc Robert Jarzmik <[email protected]>

---
v2: use kcalloc() instead of open-coding the same through
kmalloc_array(__GFP_ZERO)

 drivers/video/fbdev/pxafb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/pxafb.c +2 -2
index c2c2e2790079..4752b218fac4 100644
@@ -2130,8 +2130,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
 		return -EINVAL;
 
 	ret = -ENOMEM;
-	info->modes = kmalloc_array(timings->num_timings,
-				    sizeof(info->modes[0]), GFP_KERNEL);
+	info->modes = kcalloc(timings->num_timings, sizeof(info->modes[0]),
+			      GFP_KERNEL);
 	if (!info->modes)
 		goto out;
 	info->num_modes = timings->num_timings;
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 2 lines · Daniel Mack

When parsing the video modes from DT properties, make sure to zero out memory befor using it. This is important because not all fields in the mode

s/befor/before/

This taken care of ...

Cheers.

--
Robert

#2 lore raw
In reply to Daniel Mack
Quoted 6 lines · Robert Jarzmik
Quoted 2 lines · Daniel Mack

When parsing the video modes from DT properties, make sure to zero out memory befor using it. This is important because not all fields in the mode

s/befor/before/

Yeah, seen this too after sending. Should I resend, or can this be amended when applying?

Quoted 2 lines

This taken care of ...

Thanks,
Daniel

#3 lore raw
In reply to Daniel Mack
Quoted 10 lines · Daniel Mack
Quoted 6 lines · Robert Jarzmik
Quoted 2 lines · Daniel Mack

When parsing the video modes from DT properties, make sure to zero out memory befor using it. This is important because not all fields in the mode

s/befor/before/

Yeah, seen this too after sending. Should I resend, or can this be amended when applying?

I think this question is for Bartlomiej, as fbdev is his tree ...

Quoted 2 lines
Quoted 2 lines

This taken care of ...

Cheers.

Signature · 1 line
Robert
#4 lore raw
In reply to Daniel Mack
Quoted 5 lines · Robert Jarzmik
Quoted 3 lines · Daniel Mack
Quoted 2 lines · Robert Jarzmik

Daniel Mack <[email protected]> writes:

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

When parsing the video modes from DT properties, make sure to zero out memory befor using it. This is important because not all fields in the mode

s/befor/before/

Yeah, seen this too after sending. Should I resend, or can this be amended when applying?

I think this question is for Bartlomiej, as fbdev is his tree ...

I will fix this typo while applying, no need for resend..

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

This taken care of ...

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#5 lore raw
In reply to Daniel Mack
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Robert Jarzmik
Quoted 5 lines · Daniel Mack
Quoted 4 lines · Robert Jarzmik
Quoted 2 lines · Daniel Mack

When parsing the video modes from DT properties, make sure to zero out memory befor using it. This is important because not all fields in the mode

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

s/befor/before/

Yeah, seen this too after sending. Should I resend, or can this be amended when applying?

I think this question is for Bartlomiej, as fbdev is his tree ...

I will fix this typo while applying, no need for resend..

Hang on. I have some more patches on top, so I'll resend this one as part of a bigger series soon.

Thanks,
Daniel