From 36e8c27f3bee5e58f96b0a79d65922fa9e53b030 Mon Sep 17 00:00:00 2001 From: Samreen Date: Tue, 16 Nov 2010 12:49:07 +0100 Subject: OMAP: DSS2: OMAPFB: Add null pointer check A null pointer check added. And using kstrdup() instead of kmalloc() & strcpy() Signed-off-by: Samreen Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/omapfb/omapfb-main.c | 5 +++-- 1 file 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) { -- cgit v1.1