OMAP: DSS2: OMAPFB: Add null pointer check
PATCH v2 1/1 OMAP: DSS2: OMAPFB: Add null pointer check
A null pointer check added. And using kstrdup()
instead of kmalloc() & strcpy()
Signed-off-by Samreen <[email protected]>
---
Version2:
- Using kstrdup() instead of kmalloc() & strcpy()
- Using ENOMEM as error code instead of EINVAL
- Subject changed appropriately
The link to v1 of patch is:
https://patchwork.kernel.org/patch/319642/
drivers/video/omap2/omapfb/omapfb-main.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +3 -2
@@ -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 ) {
Signature · 1 line
1.5.6.3
Tomi Valkeinen
AppliedQuoted 4 lines · ext Samreen
A null pointer check added. And using
kstrdup()
instead ofkmalloc()&strcpy()Signed-off-by Samreen <[email protected]>
Quoted 8 lines
---
Version2:
- Usingkstrdup()instead ofkmalloc()&strcpy()
- Using ENOMEM as error code instead of EINVAL
- Subject changed appropriatelyThe link to v1 of patch is:
https://patchwork.kernel.org/patch/319642/
Thanks, applied.
Tomi