net: netfilter: Remove multiple assignment.
Subsystems (3)
PATCH 1/1 net: netfilter: Remove multiple assignment.
This patch removes multiple assignments.
Done using coccinelle.
@@
identifier i1,i2;
constant c;
@@
- i1=i2=c;
+ i1=c;
+ i2=c;
---
contribution to outreachy netfilter project.
net/netfilter/nf_conntrack_proto_sctp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_proto_sctp.c +2 -1
@@ -346,7 +346,8 @@ static int sctp_packet(struct nf_conn *ct, goto out; } - old_state = new_state =SCTP_CONNTRACK_NONE ; + old_state =SCTP_CONNTRACK_NONE ; + new_state = old_state;spin_lock_bh (&ct->lock); for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) {/* Special cases of Verification tag check (Sec 8.5.1) */
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerQuoted 9 lines · Arushi Singhal
This patch removes multiple assignments.
Done using coccinelle.
@@
identifier i1,i2;
constant c;
@@
- i1=i2=c;
+ i1=c;
+ i2=c;
You have to explain why this is bad.
Quoted 11 lines · Pablo Neira Ayuso
Quoted 9 lines · Arushi Singhal
This patch removes multiple assignments.
Done using coccinelle.
@@
identifier i1,i2;
constant c;
@@
- i1=i2=c;
+ i1=c;
+ i2=c;
Quoted 2 lines
You have to explain why this is bad.
It is against the kernel coding style and we have to avoid multiple assignments to make the code more readable.
This error is found using Checkpatch.pl script.
Thanks
Arushi
Pablo Neira Ayuso
maintainerQuoted 14 lines · Arushi Singhal
Quoted 11 lines · Pablo Neira Ayuso
Quoted 9 lines · Arushi Singhal
This patch removes multiple assignments.
Done using coccinelle.
@@
identifier i1,i2;
constant c;
@@
- i1=i2=c;
+ i1=c;
+ i2=c;
Quoted 6 lines
Quoted 2 lines
You have to explain why this is bad.
It is against the kernel coding style and we have to avoid multiple assignments to make the code more readable.
This error is found using Checkpatch.pl script.
Then, please place this information in your patch description.
Thanks!
From: Pablo Neira Ayuso
Quoted 12 lines
Sent: 27 March 2017 13:08
Quoted 9 lines · Arushi Singhal
This patch removes multiple assignments.
Done using coccinelle.
@@
identifier i1,i2;
constant c;
@@
- i1=i2=c;
+ i1=c;
+ i2=c;
Quoted 1 line
You have to explain why this is bad.
And your substituted code isn't equivalent.
The correct replacement is:
i2 = c; i1 = i2; David