Skip to contentSkip to conversation

ubifs: Fix build warning

PATCH In review Alexandre Pereira da Silva 2 participants 2 messages Jun 25, 2012 – Jun 29, 2012

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

PATCH v2 1/1 ubifs: Fix build warning

Fix:
fs/ubifs/dir.c: In function 'ubifs_rename':
fs/ubifs/dir.c:972:15: warning: 'saved_nlink' may be used uninitialized in this function

Use gcc uninitialized_var macro to avoid bogus warning

---
Applies to v3.5-rc4

Changes since v1:
Use uninitialized_var macro

 fs/ubifs/dir.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ubifs/dir.c +2 -1
index a6d42ef..40c2d04 100644
@@ -41,6 +41,7 @@
  */
 
 #include "ubifs.h"
+#include <linux/compiler.h>
 
 /**
  * inherit_flags - inherit flags of the parent inode.
@@ -969,7 +970,7 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	struct ubifs_budget_req ino_req = { .dirtied_ino = 1,
 			.dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) };
 	struct timespec time;
-	unsigned int saved_nlink;
+	unsigned int uninitialized_var(saved_nlink);
 
 	/*
 	 * Budget request settings: deletion direntry, new direntry, removing
Signature · 1 line
1.7.10
#1 lore raw
Quoted 2 lines · Alexandre Pereira da Silva

#include "ubifs.h"
+#include <linux/compiler.h>

This is not needed, I've removed this chunk and pushed to linux-ubifs.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy