Skip to contentSkip to conversation

mptcp: Fix unsigned 'max_seq' compared with zero in mptcp_data_queue_ofo

PATCH Superseded Ye Bin 2 participants 2 messages Sep 16, 2020

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ye Bin

author
#0 lore raw

PATCH v2 1/1 mptcp: Fix unsigned 'max_seq' compared with zero in mptcp_data_queue_ofo

Fixes coccicheck warnig:
net/mptcp/protocol.c:164:11-18: WARNING: Unsigned expression compared with zero: max_seq > 0

Fixes ab174ad8ef76 ("mptcp: move ooo skbs into msk out of order queue")
Reported-by Hulk Robot <hulkci(a)huawei.com>
Signed-off-by Ye Bin <yebin10(a)huawei.com>
---
 net/mptcp/protocol.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/mptcp/protocol.c +3 -2
index ef0dd2f23482..3b71f6202524 100644
@@ -155,13 +155,14 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
 {
 	struct sock *sk = (struct sock *)msk;
 	struct rb_node **p, *parent;
+	int space;
 	u64 seq, end_seq, max_seq;
 	struct sk_buff *skb1;
 
 	seq = MPTCP_SKB_CB(skb)->map_seq;
 	end_seq = MPTCP_SKB_CB(skb)->end_seq;
-	max_seq = tcp_space(sk);
-	max_seq = max_seq > 0 ? max_seq + msk->ack_seq : msk->ack_seq;
+	space = tcp_space(sk);
+	max_seq = space > 0 ? space + msk->ack_seq : msk->ack_seq;
 
 	pr_debug("msk=%p seq=%llx limit=%llx empty=%d", msk, seq, max_seq,
 		 RB_EMPTY_ROOT(&msk->out_of_order_queue));
Signature · 1 line
2.25.4
#1 lore raw

Hi Ye,

Thank you for this v2.

Quoted 15 lines · Ye Bin

Fixes coccicheck warnig:
net/mptcp/protocol.c:164:11-18: WARNING: Unsigned expression compared with zero: max_seq > 0

Fixes ab174ad8ef76 ("mptcp: move ooo skbs into msk out of order queue")
Reported-by Hulk Robot <hulkci(a)huawei.com>
Signed-off-by Ye Bin <yebin10(a)huawei.com>
---
  net/mptcp/protocol.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
net/mptcp/protocol.c +0 -0
index ef0dd2f23482..3b71f6202524 100644

net/mptcp/protocol.c static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) · line 160

Quoted 6 lines
net/mptcp/protocol.c +1 -0
@@ -155,13 +155,14 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
  {
  	struct sock *sk = (struct sock *)msk;
  	struct rb_node **p, *parent;
+	int space;
  	u64 seq, end_seq, max_seq;
  	struct sk_buff *skb1;

In the network subsystem, variables have to be declared following the "reverse Xmas tree" order: longest to shortest line length.

Could you then please move your new variable to the end of the list, under skb1?

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net