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: 朱东海(启路) <donghai.zdh@alibaba-inc.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2015-07-15 17:17:28 +01:00
parent 39b8e7dcaf
commit d6812d60e7
1 changed files with 157 additions and 160 deletions

View File

@ -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 */