summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorSamreen <samreen@ti.com>2010-11-16 12:49:07 +0100
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2011-01-10 11:09:53 +0200
commit36e8c27f3bee5e58f96b0a79d65922fa9e53b030 (patch)
tree75688c1c16266541d464ba73177e8600be6fe9e9 /drivers/video
parented3f90954654a5d9d07b30d39434392a644602fb (diff)
OMAP: DSS2: OMAPFB: Add null pointer check
A null pointer check added. And using kstrdup() instead of kmalloc() & strcpy() Signed-off-by: Samreen <samreen@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/omapfb/omapfb-main.c5
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 6a704f176c2..4fdab8e9c49 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) {