Skip to content

Commit

Permalink
OMAP: DSS2: OMAPFB: Add null pointer check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Samreen authored and Tomi Valkeinen committed Jan 10, 2011
1 parent ed3f909 commit 36e8c27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/video/omap2/omapfb/omapfb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 36e8c27

Please sign in to comment.