Remove redundant length checking
Signed-off-by: wangjunfeng0 <wangjunfeng3@xiaomi.com>
This commit is contained in:
parent
c74cb1aaa5
commit
b2b014df0b
@ -74,13 +74,6 @@ uint16_t ipv4_upperlayer_chksum(FAR struct net_driver_s *dev, uint8_t proto)
|
|||||||
|
|
||||||
upperlen = (((uint16_t)(ipv4->len[0]) << 8) + ipv4->len[1]) - iphdrlen;
|
upperlen = (((uint16_t)(ipv4->len[0]) << 8) + ipv4->len[1]) - iphdrlen;
|
||||||
|
|
||||||
/* Verify some minimal assumptions */
|
|
||||||
|
|
||||||
if (upperlen > NETDEV_PKTSIZE(dev))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First sum pseudo-header.
|
/* First sum pseudo-header.
|
||||||
*
|
*
|
||||||
* IP protocol and length fields. This addition cannot carry.
|
* IP protocol and length fields. This addition cannot carry.
|
||||||
@ -142,13 +135,6 @@ uint16_t ipv6_upperlayer_chksum(FAR struct net_driver_s *dev,
|
|||||||
|
|
||||||
upperlen -= (iplen - IPv6_HDRLEN);
|
upperlen -= (iplen - IPv6_HDRLEN);
|
||||||
|
|
||||||
/* Verify some minimal assumptions */
|
|
||||||
|
|
||||||
if (upperlen > NETDEV_PKTSIZE(dev))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The checksum is calculated starting with a pseudo-header of IPv6 header
|
/* The checksum is calculated starting with a pseudo-header of IPv6 header
|
||||||
* fields according to the IPv6 standard, which consists of the source
|
* fields according to the IPv6 standard, which consists of the source
|
||||||
* and destination addresses, the packet length and the next header field.
|
* and destination addresses, the packet length and the next header field.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user