Skip to contentSkip to conversation

fix a compiling warning

PATCH New piaojun 3 participants 3 messages May 7, 2018 – May 8, 2018 1 message not in the archive OCFS2

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

piaojun

author
#1 lore raw

PATCH 1/1 fix a compiling warning

Hi Larry,

'had_lock' will be initialized by ocfs2_inode_lock_tracker(), and the 'bail' branch above won't use it either as 'inode_locked' is still zero.

thanks,
Jun

Quoted 21 lines · Larry Chen

The variable had_lock might be used uninitialized.

---
 fs/ocfs2/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/file.c +1 -1
index 6ee94bc23f5b..50f17f56db36 100644
@@ -1133,7 +1133,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
 	handle_t *handle = NULL;
 	struct dquot *transfer_to[MAXQUOTAS] = { };
 	int qtype;
-	int had_lock;
+	int had_lock = 0;
 	struct ocfs2_lock_holder oh;
 
 	trace_ocfs2_setattr(inode, dentry,
#2 lore raw

PATCH 1/1 fix a compiling warning

Hi Jun

Yeah,I know your logic is right.
It's just a compile warning that made me feel uncomfortable.

:)

Quoted 30 lines · piaojun

Hi Larry,

'had_lock' will be initialized by ocfs2_inode_lock_tracker(), and the 'bail' branch above won't use it either as 'inode_locked' is still zero.

thanks,
Jun

Quoted 21 lines · Larry Chen

The variable had_lock might be used uninitialized.

---
  fs/ocfs2/file.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/file.c +1 -1
index 6ee94bc23f5b..50f17f56db36 100644
@@ -1133,7 +1133,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
  	handle_t *handle = NULL;
  	struct dquot *transfer_to[MAXQUOTAS] = { };
  	int qtype;
-	int had_lock;
+	int had_lock = 0;
  	struct ocfs2_lock_holder oh;
 
  	trace_ocfs2_setattr(inode, dentry,
#3 lore raw

PATCH 1/1 fix a compiling warning

Hi Larry,

It would be better for you to paste the compilation warning and gcc version.

So we can justify if it is deserved to be fixed.

Thanks,

Changwei

Quoted 45 lines · Larry Chen

Hi Jun

Yeah,I know your logic is right.
It's just a compile warning that made me feel uncomfortable.

:)

Quoted 28 lines · piaojun

Hi Larry,

'had_lock' will be initialized by ocfs2_inode_lock_tracker(), and the 'bail' branch above won't use it either as 'inode_locked' is still zero.

thanks,
Jun

Quoted 19 lines · Larry Chen

The variable had_lock might be used uninitialized.

---
   fs/ocfs2/file.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/file.c +1 -1
index 6ee94bc23f5b..50f17f56db36 100644
@@ -1133,7 +1133,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
   	handle_t *handle = NULL;
   	struct dquot *transfer_to[MAXQUOTAS] = { };
   	int qtype;
-	int had_lock;
+	int had_lock = 0;
   	struct ocfs2_lock_holder oh;
 
Quoted 2 lines

fs/ocfs2/file.c int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) · line 1139

Quoted 2 lines
fs/ocfs2/file.c +0 -0
   	trace_ocfs2_setattr(inode, dentry,

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel