All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang YanQing <udknight@gmail.com>
To: FlorianSchandinat@gmx.de
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	spock@gentoo.org
Subject: [PATCH] video:uvesafb: check the return value of kzalloc
Date: Mon, 13 Aug 2012 10:02:32 +0000	[thread overview]
Message-ID: <20120813100232.GA16363@udknight> (raw)


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(+)

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);
 
-- 
1.7.11.1.116.g8228a23

WARNING: multiple messages have this Message-ID (diff)
From: Wang YanQing <udknight@gmail.com>
To: FlorianSchandinat@gmx.de
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	spock@gentoo.org
Subject: [PATCH] video:uvesafb: check the return value of kzalloc
Date: Mon, 13 Aug 2012 18:02:32 +0800	[thread overview]
Message-ID: <20120813100232.GA16363@udknight> (raw)


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(+)

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);
 
-- 
1.7.11.1.116.g8228a23

             reply	other threads:[~2012-08-13 10:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 10:02 Wang YanQing [this message]
2012-08-13 10:02 ` [PATCH] video:uvesafb: check the return value of kzalloc Wang YanQing
2012-08-23 20:43 ` Florian Tobias Schandinat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120813100232.GA16363@udknight \
    --to=udknight@gmail.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spock@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.