Commit d6812d60 authored by Stefan Hajnoczi's avatar Stefan Hajnoczi
Browse files

rtl8139: drop tautologous if (ip) {...} statement (CVE-2015-5165)



The previous patch stopped using the ip pointer as an indicator that the
IP header is present.  When we reach the if (ip) {...} statement we know
ip is always non-NULL.

Remove the if statement to reduce nesting.

Reported-by: default avatar朱东海(启路) <donghai.zdh@alibaba-inc.com>
Reviewed-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 39b8e7dc
Loading
Loading
Loading
Loading
+151 −154
Original line number Diff line number Diff line
@@ -2184,8 +2184,6 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
            ip_protocol = ip->ip_p;
            ip_data_len = be16_to_cpu(ip->ip_len) - hlen;

            if (ip)
            {
            if (txdw0 & CP_TX_IPCS)
            {
                DPRINTF("+++ C+ mode need IP checksum\n");
@@ -2377,7 +2375,6 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
                memcpy(eth_payload_data, saved_ip_header, hlen);
            }
        }
        }

skip_offload:
        /* update tally counter */