Skip to contentSkip to conversation

Squashfs: silence some uninitialized variable warnings

PATCH In review Dan Carpenter 2 participants 3 messages Jul 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Squashfs: silence some uninitialized variable warnings

We print these values in the TRACE() code before we check that fill_meta_index() was successful. It makes my static checker complain.

fs/squashfs/file.c +2 -2
index 13d8094..46679e2 100644
@@ -334,9 +334,9 @@ failed:
  */
 static int read_blocklist(struct inode *inode, int index, u64 *block)
 {
-	u64 start;
+	u64 start = -1;
 	long long blks;
-	int offset;
+	int offset = -1;
 	__le32 size;
 	int res = fill_meta_index(inode, index, &start, &offset, block);
 
#1 lore raw

Hi Dan

Quoted 10 lines · Dan Carpenter

We print these values in the TRACE() code before we check that fill_meta_index() was successful. It makes my static checker complain.

fs/squashfs/file.c +0 -0
index 13d8094..46679e2 100644

fs/squashfs/file.c failed: · line 337

Quoted 5 lines
fs/squashfs/file.c +1 -1
@@ -334,9 +334,9 @@ failed:
  */
 static int read_blocklist(struct inode *inode, int index, u64 *block)
 {
-       u64 start;
+       u64 start = -1;

Do you assign the negative value to the unsigned variable here on purpose?

Cheers,

Silvan

#2 lore raw
Quoted 9 lines · Silvan Jegen

Hi Dan

Quoted 5 lines · Dan Carpenter

We print these values in the TRACE() code before we check that fill_meta_index() was successful. It makes my static checker complain.

Quoted 13 lines

fs/squashfs/file.c failed: · line 337

Quoted 10 lines
fs/squashfs/file.c +1 -1
index 13d8094..46679e2 100644
@@ -334,9 +334,9 @@ failed:
  */
 static int read_blocklist(struct inode *inode, int index, u64 *block)
 {
-       u64 start;
+       u64 start = -1;

Do you assign the negative value to the unsigned variable here on purpose?

Yeah. It's just a garbage value but hopefully it would stand out in the printk.

regards,
dan carpenter