[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210311103446.5dwjcopeggy7k6gg@kewl-virtual-machine>
Date: Thu, 11 Mar 2021 16:04:46 +0530
From: Shubhankar Kuranagatti <shubhankarvk@...il.com>
To: davem@...emloft.net
Cc: kuba@...nel.org, edumazet@...gle.com, willemb@...gle.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
mchehab+huawei@...nel.org
Subject: [PATCH 1/2] net: core: datagram.c: Fix use of assignment in if
condition
The assignment inside the if condition has been changed to
initialising outside the if condition.
Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@...il.com>
---
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;
}
@@ -439,7 +440,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
WARN_ON(start > offset + len);
end = start + skb_frag_size(frag);
- if ((copy = end - offset) > 0) {
+ copy = end - offset
+ if ((copy) > 0) {
struct page *page = skb_frag_page(frag);
u8 *vaddr = kmap(page);
@@ -452,7 +454,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
offset += n;
if (n != copy)
goto short_copy;
- if (!(len -= copy))
+ len -= copy
+ if (!(len))
return 0;
}
start = end;
@@ -464,13 +467,15 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
WARN_ON(start > offset + len);
end = start + frag_iter->len;
- if ((copy = end - offset) > 0) {
+ copy = end - offset;
+ if ((copy) > 0) {
if (copy > len)
copy = len;
if (__skb_datagram_iter(frag_iter, offset - start,
to, copy, fault_short, cb, data))
goto fault;
- if ((len -= copy) == 0)
+ len -= copy
+ if ((len) == 0)
return 0;
offset += copy;
}
@@ -558,7 +563,8 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
copy = len;
if (copy_from_iter(skb->data + offset, copy, from) != copy)
goto fault;
- if ((len -= copy) == 0)
+ len -= copy;
+ if ((len) == 0)
return 0;
offset += copy;
}
@@ -571,7 +577,8 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
WARN_ON(start > offset + len);
end = start + skb_frag_size(frag);
- if ((copy = end - offset) > 0) {
+ copy = end - offset;
+ if ((copy) > 0) {
size_t copied;
if (copy > len)
@@ -581,8 +588,8 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
copy, from);
if (copied != copy)
goto fault;
-
- if (!(len -= copy))
+ len -= copy
+ if (!(len))
return 0;
offset += copy;
}
@@ -595,14 +602,16 @@ int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
WARN_ON(start > offset + len);
end = start + frag_iter->len;
- if ((copy = end - offset) > 0) {
+ copy = end - offset;
+ if ((copy) > 0) {
if (copy > len)
copy = len;
if (skb_copy_datagram_from_iter(frag_iter,
offset - start,
from, copy))
goto fault;
- if ((len -= copy) == 0)
+ len -= copy;
+ if ((len) == 0)
return 0;
offset += copy;
}
--
2.17.1
Powered by blists - more mailing lists