diff options
author | Samreen <samreen@ti.com> | 2010-11-16 06:49:07 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2011-01-10 04:09:53 -0500 |
commit | 36e8c27f3bee5e58f96b0a79d65922fa9e53b030 (patch) | |
tree | 75688c1c16266541d464ba73177e8600be6fe9e9 /drivers/video | |
parent | ed3f90954654a5d9d07b30d39434392a644602fb (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.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 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) | |||
2132 | char *str, *options, *this_opt; | 2132 | char *str, *options, *this_opt; |
2133 | int r = 0; | 2133 | int r = 0; |
2134 | 2134 | ||
2135 | str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL); | 2135 | str = kstrdup(def_mode, GFP_KERNEL); |
2136 | strcpy(str, def_mode); | 2136 | if (!str) |
2137 | return -ENOMEM; | ||
2137 | options = str; | 2138 | options = str; |
2138 | 2139 | ||
2139 | while (!r && (this_opt = strsep(&options, ",")) != NULL) { | 2140 | while (!r && (this_opt = strsep(&options, ",")) != NULL) { |