mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
ed3f909546
commit
36e8c27f3b
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue