Skip to contentSkip to conversation

ARM: S5PV210: Fix possible null pointer dereference.

PATCH New Kukjin Kim 2 participants 3 messages May 13, 2011 – May 16, 2011

Subsystems (3)
lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH 1/1 ARM: S5PV210: Fix possible null pointer dereference.

From: Jonghwan Choi <[email protected]>

---
 arch/arm/mach-s5pv210/cpufreq.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-s5pv210/cpufreq.c +3 -1
index 22046e2..58340ee 100644
@@ -105,8 +105,10 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq)
 		reg = (S5P_VA_DMC0 + 0x30);
 	else if (ch == DMC1)
 		reg = (S5P_VA_DMC1 + 0x30);
-	else
+	else {
 		printk(KERN_ERR "Cannot find DMC port\n");
+		return;
+	}
 
 	/* Find current DRAM frequency */
 	tmp = s5pv210_dram_conf[ch].freq;
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 ARM: S5PV210: Fix possible null pointer dereference.

Hello.

Quoted 13 lines · Kukjin Kim

From: Jonghwan Choi<[email protected]>

---
  arch/arm/mach-s5pv210/cpufreq.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-s5pv210/cpufreq.c +0 -0
index 22046e2..58340ee 100644

arch/arm/mach-s5pv210/cpufreq.c static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq) · line 111

Quoted 8 lines
arch/arm/mach-s5pv210/cpufreq.c +3 -1
@@ -105,8 +105,10 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq)
  		reg = (S5P_VA_DMC0 + 0x30);
  	else if (ch == DMC1)
  		reg = (S5P_VA_DMC1 + 0x30);
-	else
+	else {
  		printk(KERN_ERR "Cannot find DMC port\n");
+		return;
+	}

According to CodingStyle, other branches should now have {} too.

WBR, Sergei

author
#2 lore raw

PATCH 1/1 ARM: S5PV210: Fix possible null pointer dereference.

Quoted 3 lines · Sergei Shtylyov

Hello.

Hi ;)

Quoted 17 lines · Kukjin Kim

arch/arm/mach-

Quoted 10 lines

From: Jonghwan Choi<[email protected]>

---
  arch/arm/mach-s5pv210/cpufreq.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-s5pv210/cpufreq.c +0 -0

s5pv210/cpufreq.c

arch/arm/mach-s5pv210/cpufreq.c static void s5pv210_set_refresh(enum

Quoted 4 lines

index 22046e2..58340ee 100644

arch/arm/mach-s5pv210/cpufreq.c +0 -0
@@ -105,8 +105,10 @@ static void s5pv210_set_refresh(enum

s5pv210_dmc_port ch, unsigned long freq)

Quoted 11 lines

arch/arm/mach-s5pv210/cpufreq.c static void s5pv210_set_refresh(enum · line 111

Quoted 8 lines
arch/arm/mach-s5pv210/cpufreq.c +3 -1
  		reg = (S5P_VA_DMC0 + 0x30);
  	else if (ch == DMC1)
  		reg = (S5P_VA_DMC1 + 0x30);
-	else
+	else {
  		printk(KERN_ERR "Cannot find DMC port\n");
+		return;
+	}

According to CodingStyle, other branches should now have {} too.

Yes, you're right.

I updated its commit in my tree like following.

---

(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/cpufreq.c
index 22046e2..153af8b 100644

arch/arm/mach-s5pv210/cpufreq.c +0 -0
@@ -101,12 +101,14 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port

ch, unsigned long freq)

        unsigned long tmp, tmp1;
        void __iomem *reg = NULL;

- if (ch == DMC0)

+       if (ch == DMC0) {
                reg = (S5P_VA_DMC0 + 0x30);
-       else if (ch == DMC1)
+       } else if (ch == DMC1) {
                reg = (S5P_VA_DMC1 + 0x30);
-       else
+       } else {
                printk(KERN_ERR "Cannot find DMC port\n");

+ return;
+ }

        /* Find current DRAM frequency */
        tmp = s5pv210_dram_conf[ch].freq;

---

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.