Skip to contentSkip to conversation

cmd_nand: Fix possible uninited max_size variable

PATCH New Marek Vasut 3 participants 3 messages Mar 23, 2012 – Mar 27, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd_nand: Fix possible uninited max_size variable

GCC 4.7 error:
cmd_nand.c: In function ?arg_off_size?:
cmd_nand.c:216:5: warning: ?maxsize? may be used uninitialized in this function [-Wmaybe-uninitialized]

---
 common/cmd_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_nand.c +1 -1
index 035a6f6..b015d11 100644
@@ -191,7 +191,7 @@ static int arg_off_size(int argc, char *const argv[], int *idx,
 			loff_t *off, loff_t *size)
 {
 	int ret;
-	loff_t maxsize;
+	loff_t maxsize = 0;
 
 	if (argc == 0) {
 		*off = 0;
Signature · 1 line
1.7.9.1
#1 lore raw

PATCH 1/1 cmd_nand: Fix possible uninited max_size variable

Quoted 3 lines · Marek Vasut

GCC 4.7 error:
cmd_nand.c: In function ?arg_off_size?:
cmd_nand.c:216:5: warning: ?maxsize? may be used uninitialized in this function [-Wmaybe-uninitialized]

Yay, with a new compiler comes a new batch of false positives. :-P

I'm surprised it complained at line 216 but not line 208.

Quoted 11 lines
---
 common/cmd_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_nand.c +0 -0
index 035a6f6..b015d11 100644

common/cmd_nand.c static int arg_off_size(int argc, char *const argv[], int *idx, · line 197

Quoted 8 lines
common/cmd_nand.c +1 -1
@@ -191,7 +191,7 @@ static int arg_off_size(int argc, char *const argv[], int *idx,
 			loff_t *off, loff_t *size)
 {
 	int ret;
-	loff_t maxsize;
+	loff_t maxsize = 0;
 
 	if (argc == 0) {
 		*off = 0;

I'll apply for next merge window.

-Scott

#2 lore raw

PATCH 1/1 cmd_nand: Fix possible uninited max_size variable

Dear Scott Wood,

Quoted 7 lines · Marek Vasut
Quoted 4 lines

GCC 4.7 error:
cmd_nand.c: In function ?arg_off_size?:
cmd_nand.c:216:5: warning: ?maxsize? may be used uninitialized in this function [-Wmaybe-uninitialized]

Yay, with a new compiler comes a new batch of false positives. :-P

And I'm the early adopter ... crusader of new compiler tests with uboot ;-D

Quoted 32 lines

I'm surprised it complained at line 216 but not line 208.

Quoted 16 lines

---

 common/cmd_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_nand.c +0 -0
index 035a6f6..b015d11 100644
@@ -191,7 +191,7 @@ static int arg_off_size(int argc, char *const argv[],
 int *idx,
 
 			loff_t *off, loff_t *size)
 

common/cmd_nand.c static int arg_off_size(int argc, char *const argv[], · line 197

Quoted 10 lines
common/cmd_nand.c +1 -1
 {
 
 	int ret;
 
-	loff_t maxsize;
+	loff_t maxsize = 0;
 
 	if (argc == 0) {
 
 		*off = 0;

I'll apply for next merge window.

Quoted 6 lines

-Scott

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Best regards,
Marek Vasut