Thread (3 messages) flat view 3 messages, 3 authors, 2021-03-11

Re: [PATCH 1/2] net: core: datagram.c: Fix use of assignment in if condition

From: Eric Dumazet <edumazet@google.com>
Date: 2021-03-11 11:00:49
Also in: lkml

On Thu, Mar 11, 2021 at 11:34 AM Shubhankar Kuranagatti
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
The assignment inside the if condition has been changed to
initialising outside the if condition.

Signed-off-by: Shubhankar Kuranagatti <redacted>
---
 net/core/datagram.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 15ab9ffb27fe..7b2204f102b7 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -427,7 +427,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
                offset += n;
                if (n != copy)
                        goto short_copy;
-               if ((len -= copy) == 0)
+               len -= copy
+               if ((len) == 0)
                        return 0;

Quite frankly I prefer the current style.

It also seems you have not even compiled your change, this is not a good start.

Lets keep reviewer time to review patches that really bring an improvement,
since stylistic changes like that make our backports more likely to
have conflicts.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help