ocfs2: fix uninitialized variable access
PATCH 1/2 ocfs2: fix uninitialized variable access
Variable "why" is not yet initialized at line 615, fix it.
--- fs/ocfs2/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/file.c +1 -1
@@ -569,7 +569,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,handle_t *handle =NULL ;struct ocfs2_alloc_context *data_ac =NULL ;struct ocfs2_alloc_context *meta_ac =NULL ; -enum ocfs2_alloc_restarted why; +enum ocfs2_alloc_restarted why =RESTART_NONE ;struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);struct ocfs2_extent_tree et;int did_quota =0 ;
Signature · 1 line
1.7.9.5
PATCH 2/2 ocfs2: fix wrong comment
O2NET_CONN_IDLE_DELAY is not defined, connection attempts will not be canceled due to timeout.
--- fs/ocfs2/cluster/tcp_internal.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/ocfs2/cluster/tcp_internal.h +6 -6
@@ -107,12 +107,12 @@ struct o2net_node {struct list_head nn_status_list;/* connects are attempted from when heartbeat comes up until either hb -* goes down, the node is unconfigured, no connect attempts succeed -* before O2NET_CONN_IDLE_DELAY, or a connect succeeds. connect_work -* is queued from set_nn_state both from hb up and from itself if a -* connect attempt fails and so can be self-arming. shutdown is -* careful to first mark the nn such that no connects will be attempted -* before canceling delayed connect work and flushing the queue. */ +* goes down, the node is unconfigured, or a connect succeeds. +* connect_work is queued from set_nn_state both from hb up and from +* itself if a connect attempt fails and so can be self-arming. +* shutdown is careful to first mark the nn such that no connects will +* be attempted before canceling delayed connect work and flushing the +* queue. */ struct delayed_work nn_connect_work;unsigned long nn_last_connect_attempt;
Signature · 1 line
1.7.9.5
PATCH 1/2 ocfs2: fix uninitialized variable access
In reply to Junxiao BiQuoted 7 lines · On Thu, 25 Dec 2014 13:52:16 +0800 Junxiao Bi <[email protected]> wrote:
Variable "why" is not yet initialized at line 615, fix it.
...
fs/ocfs2/file.c static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, · line 575
Quoted 8 lines
fs/ocfs2/file.c +1
-1@@ -569,7 +569,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,handle_t *handle =NULL ;struct ocfs2_alloc_context *data_ac =NULL ;struct ocfs2_alloc_context *meta_ac =NULL ; -enum ocfs2_alloc_restarted why; +enum ocfs2_alloc_restarted why =RESTART_NONE ;struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);struct ocfs2_extent_tree et;int did_quota =0 ;
Oh geeze, are you really sure about this? __ocfs2_extend_allocation() is as clear as mud. What happens when ocfs2_add_inode_data() returns -EAGAIN and leaves *reason_ret unwritten to?
What are the runtime effects of this bug?
PATCH 1/2 ocfs2: fix uninitialized variable access
Quoted 6 lines · Andrew Morton
Quoted 4 lines · On Thu, 25 Dec 2014 13:52:16 +0800 Junxiao Bi <[email protected]> wrote:
Variable "why" is not yet initialized at line 615, fix it.
...
Quoted 15 lines
fs/ocfs2/file.c static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, · line 575
Quoted 11 lines
fs/ocfs2/file.c +1
-1@@ -569,7 +569,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,handle_t *handle =NULL ;struct ocfs2_alloc_context *data_ac =NULL ;struct ocfs2_alloc_context *meta_ac =NULL ; -enum ocfs2_alloc_restarted why; +enum ocfs2_alloc_restarted why =RESTART_NONE ;struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);struct ocfs2_extent_tree et;int did_quota =0 ;Oh geeze, are you really sure about this?
__ocfs2_extend_allocation()is as clear as mud. What happens whenocfs2_add_inode_data()returns-EAGAINand leaves*reason_retunwritten to?
*reason_ret will always be written when ocfs2_add_inode_data() return.
Quoted 2 lines
What are the runtime effects of this bug?
I didn't see any other effects except a compile warning and an uninitialized variable from the tracepoint.
Thanks,
Junxiao.