Skip to content

Commit

Permalink
net/eth: fix incorrect check of iov_to_buf() return value
Browse files Browse the repository at this point in the history
So we have sizeof(struct in6_address) != sizeof(uintptr_t)
and Clang > Coverity on this, see 4555ca6 :)

net/eth.c:426:30: warning: The code calls sizeof() on a pointer type. This can produce an unexpected result
        return bytes_read == sizeof(dst_addr);
                             ^     ~~~~~~~~~~
net/eth.c:475:34: warning: The code calls sizeof() on a pointer type. This can produce an unexpected result
            return bytes_read == sizeof(src_addr);
                                 ^     ~~~~~~~~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Dmitry Fleytman <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
philmd authored and Michael Tokarev committed Jul 31, 2017
1 parent 9f26f32 commit b2caa3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
rthdr_offset + sizeof(*ext_hdr),
dst_addr, sizeof(*dst_addr));

return bytes_read == sizeof(dst_addr);
return bytes_read == sizeof(*dst_addr);
}

return false;
Expand Down Expand Up @@ -472,7 +472,7 @@ _eth_get_rss_ex_src_addr(const struct iovec *pkt, int pkt_frags,
opt_offset + sizeof(opthdr),
src_addr, sizeof(*src_addr));

return bytes_read == sizeof(src_addr);
return bytes_read == sizeof(*src_addr);
}

opt_offset += optlen;
Expand Down

0 comments on commit b2caa3b

Please sign in to comment.