diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2021-03-10 19:31:20 +0100 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2021-03-22 17:34:31 +0800 |
commit | 6f10f77dcdbc151217d19229d9aeeb93c9c1c408 (patch) | |
tree | dc794e37b920f9b21183d5d7b0dc15c9b66678b7 /net | |
parent | dbd8d3f959e5ba9b1804a5c99c7f8af42d96809b (diff) |
net/eth: Check size earlier in _eth_get_rss_ex_dst_addr()
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/eth.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -406,16 +406,14 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags, struct in6_address *dst_addr) { struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr; + size_t input_size = iov_size(pkt, pkt_frags); + size_t bytes_read; - if ((rthdr->rtype == 2) && (rthdr->segleft == 1)) { - - size_t input_size = iov_size(pkt, pkt_frags); - size_t bytes_read; - - if (input_size < ext_hdr_offset + sizeof(*ext_hdr)) { - return false; - } + if (input_size < ext_hdr_offset + sizeof(*ext_hdr)) { + return false; + } + if ((rthdr->rtype == 2) && (rthdr->segleft == 1)) { bytes_read = iov_to_buf(pkt, pkt_frags, ext_hdr_offset + sizeof(*rthdr), dst_addr, sizeof(*dst_addr)); |