Skip to contentSkip to conversation

OMAP: DSS2: OMAPFB: Fix null pointer check

PATCH Superseded Samreen 3 participants 5 messages Nov 12, 2010 – Nov 15, 2010 Framebuffer layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Samreen

author
#0 lore raw

PATCH 1/1 OMAP: DSS2: OMAPFB: Fix null pointer check

A null pointer check added.

---
 drivers/video/omap2/omapfb/omapfb-main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +2 -0
index 6a704f1..55bed89 100644
@@ -2133,6 +2133,8 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
 	int r = 0;
 
 	str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL);
+	if (str == NULL)
+		return -EINVAL;
 	strcpy(str, def_mode);
 	options = str;
 
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 12 lines · Samreen

A null pointer check added.

---
 drivers/video/omap2/omapfb/omapfb-main.c |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +0 -0
index 6a704f1..55bed89 100644

drivers/video/omap2/omapfb/omapfb-main.c static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) · line 2137

Quoted 5 lines
drivers/video/omap2/omapfb/omapfb-main.c +2 -0
@@ -2133,6 +2133,8 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
        int r = 0;
 
        str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL);
+       if (str = NULL)
+               return -EINVAL;

Shouldn't be rerutn _ENNOMEM; instead to get correct error code?

Quoted 11 lines
drivers/video/omap2/omapfb/omapfb-main.c +0 -1
        strcpy(str, def_mode);
        options = str;
 
--

1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

thank,

marek

Signature · 10 lines
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com
#3 lore raw
In reply to Samreen
Quoted 12 lines · ext Samreen

A null pointer check added.

---
 drivers/video/omap2/omapfb/omapfb-main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +0 -0
index 6a704f1..55bed89 100644

drivers/video/omap2/omapfb/omapfb-main.c static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) · line 2138

Quoted 6 lines
drivers/video/omap2/omapfb/omapfb-main.c +2 -0
@@ -2133,6 +2133,8 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
 	int r = 0;
 
 	str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL);
+	if (str = NULL)
+		return -EINVAL;
 	strcpy(str, def_mode);

While you're at it you could change the code to use kstrdup().

Signature · 1 line
Ville Syrjälä
#2 lore raw
In reply to Belisko Marek
Quoted 16 lines · Belisko Marek
Quoted 15 lines · Samreen

A null pointer check added.

---
 drivers/video/omap2/omapfb/omapfb-main.c |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +0 -0
index 6a704f1..55bed89 100644
@@ -2133,6 +2133,8 @@ static int omapfb_parse_def_modes(struct
 omapfb2_device *fbdev)        int r = 0;
 
Quoted 3 lines
Quoted 2 lines

       str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL); +       if (str == NULL) +               return -EINVAL;

Shouldn't be rerutn _ENNOMEM; instead to get correct error code?

[Samreen]
Will fix this.

Quoted 6 lines
Quoted 6 lines

       strcpy(str, def_mode);
       options = str;

--
1.5.6.3

Quoted 8 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html

thank,

marek--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Ville Syrjälä
Quoted 15 lines · Ville Syrjälä

drivers/video/omap2/omapfb/omapfb-main.c static int

Quoted 13 lines · ext Samreen

A null pointer check added.

---
 drivers/video/omap2/omapfb/omapfb-main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +0 -0
index 6a704f1..55bed89 100644
@@ -2133,6 +2133,8 @@ static int

omapfb_parse_def_modes(struct omapfb2_device *fbdev)

Quoted 8 lines

drivers/video/omap2/omapfb/omapfb-main.c static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) · line 2138

Quoted 6 lines
drivers/video/omap2/omapfb/omapfb-main.c +2 -0
 	int r = 0;
 
 	str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL);
+	if (str == NULL)
+		return -EINVAL;
 	strcpy(str, def_mode);

While you're at it you could change the code to use kstrdup().

[Samreen]
Will use kstrdup() and post the patch soon.

Warm Regards,
Samreen--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html