Skip to contentSkip to conversation

video:uvesafb: check the return value of kzalloc

PATCH Applied Wang YanQing 2 participants 2 messages Aug 13, 2012 – Aug 23, 2012 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video:uvesafb: check the return value of kzalloc

Michal maybe forgot it merely, we should add code
to check the return value of kzalloc to make the
code more robust.

---
 drivers/video/uvesafb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/uvesafb.c +2 -0
index b0e2a42..2f8f82d 100644
@@ -659,6 +659,8 @@ static int __devinit uvesafb_vbe_getedid(struct uvesafb_ktask *task,
 	task->t.flags = TF_BUF_RET | TF_BUF_ESDI;
 	task->t.buf_len = EDID_LENGTH;
 	task->buf = kzalloc(EDID_LENGTH, GFP_KERNEL);
+	if (!task->buf)
+		return -ENOMEM;
 
 	err = uvesafb_exec(task);
 
Signature · 1 line
1.7.11.1.116.g8228a23
#1 lore raw
Quoted 6 lines · Wang YanQing

Michal maybe forgot it merely, we should add code
to check the return value of kzalloc to make the
code more robust.

Applied.

Thanks,

Florian Tobias Schandinat

Quoted 17 lines
---
 drivers/video/uvesafb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/uvesafb.c +2 -0
index b0e2a42..2f8f82d 100644
@@ -659,6 +659,8 @@ static int __devinit uvesafb_vbe_getedid(struct uvesafb_ktask *task,
 	task->t.flags = TF_BUF_RET | TF_BUF_ESDI;
 	task->t.buf_len = EDID_LENGTH;
 	task->buf = kzalloc(EDID_LENGTH, GFP_KERNEL);
+	if (!task->buf)
+		return -ENOMEM;
 
 	err = uvesafb_exec(task);