Skip to content
Permalink
Browse files
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@gmail.com>
  • Loading branch information
SShubh123 authored and intel-lab-lkp committed Mar 11, 2021
1 parent 34bb975 commit 89811231e3ec535f3e5188fb8578535e13c1f1ba
Showing 1 changed file with 20 additions and 11 deletions.
@@ -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;
}

0 comments on commit 8981123

Please sign in to comment.