From: Samreen <samreen@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@nokia.com>, linux-omap@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org, Samreen <samreen@ti.com>
Subject: [PATCH v2] OMAP: DSS2: OMAPFB: Add null pointer check
Date: Tue, 16 Nov 2010 11:54:17 +0000 [thread overview]
Message-ID: <1289908147-12468-1-git-send-email-samreen@ti.com> (raw)
A null pointer check added. And using kstrdup()
instead of kmalloc() & strcpy()
Signed-off-by: Samreen <samreen@ti.com>
---
Version2:
- Using kstrdup() instead of kmalloc() & strcpy()
- Using ENOMEM as error code instead of EINVAL
- Subject changed appropriately
The link to v1 of patch is:
https://patchwork.kernel.org/patch/319642/
drivers/video/omap2/omapfb/omapfb-main.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 6a704f1..4fdab8e 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2132,8 +2132,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
char *str, *options, *this_opt;
int r = 0;
- str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL);
- strcpy(str, def_mode);
+ str = kstrdup(def_mode, GFP_KERNEL);
+ if (!str)
+ return -ENOMEM;
options = str;
while (!r && (this_opt = strsep(&options, ",")) != NULL) {
--
1.5.6.3
next reply other threads:[~2010-11-16 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 11:54 Samreen [this message]
2010-11-16 13:36 ` [PATCH v2] OMAP: DSS2: OMAPFB: Add null pointer check Tomi Valkeinen
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=1289908147-12468-1-git-send-email-samreen@ti.com \
--to=samreen@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tomi.valkeinen@nokia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).