diff mbox

video:uvesafb: check the return value of kzalloc

Message ID 20120813100232.GA16363@udknight (mailing list archive)
State New, archived
Headers show

Commit Message

wang yanqing Aug. 13, 2012, 10:02 a.m. UTC
Michal maybe forgot it merely, we should add code
to check the return value of kzalloc to make the
code more robust.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 drivers/video/uvesafb.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Florian Tobias Schandinat Aug. 23, 2012, 8:43 p.m. UTC | #1
On 08/13/2012 10:02 AM, Wang YanQing wrote:
> 
> Michal maybe forgot it merely, we should add code
> to check the return value of kzalloc to make the
> code more robust.
> 
> Signed-off-by: Wang YanQing <udknight@gmail.com>

Applied.


Thanks,

Florian Tobias Schandinat

> ---
>  drivers/video/uvesafb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
> index b0e2a42..2f8f82d 100644
> --- a/drivers/video/uvesafb.c
> +++ b/drivers/video/uvesafb.c
> @@ -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);
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index b0e2a42..2f8f82d 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -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);