Commit 1898d4e4 authored by Salil's avatar Salil Committed by David S. Miller

net: hns3: Fixes the static check warning due to missing unsupp L3 proto check

This patch fixes the static check warning due to missing handling leg of
unsupported L3 protocol type in the hns3_get_l4_protocol() function.

Fixes: 76ad4f0e ("net: hns3: Add support of HNS3 Ethernet Driver for
hip08 SoC")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9db85f33
...@@ -436,8 +436,8 @@ static int hns3_set_tso(struct sk_buff *skb, u32 *paylen, ...@@ -436,8 +436,8 @@ static int hns3_set_tso(struct sk_buff *skb, u32 *paylen,
return 0; return 0;
} }
static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
u8 *il4_proto) u8 *il4_proto)
{ {
union { union {
struct iphdr *v4; struct iphdr *v4;
...@@ -461,6 +461,8 @@ static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, ...@@ -461,6 +461,8 @@ static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
&l4_proto_tmp, &frag_off); &l4_proto_tmp, &frag_off);
} else if (skb->protocol == htons(ETH_P_IP)) { } else if (skb->protocol == htons(ETH_P_IP)) {
l4_proto_tmp = l3.v4->protocol; l4_proto_tmp = l3.v4->protocol;
} else {
return -EINVAL;
} }
*ol4_proto = l4_proto_tmp; *ol4_proto = l4_proto_tmp;
...@@ -468,7 +470,7 @@ static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, ...@@ -468,7 +470,7 @@ static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
/* tunnel packet */ /* tunnel packet */
if (!skb->encapsulation) { if (!skb->encapsulation) {
*il4_proto = 0; *il4_proto = 0;
return; return 0;
} }
/* find inner header point */ /* find inner header point */
...@@ -486,6 +488,8 @@ static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, ...@@ -486,6 +488,8 @@ static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
} }
*il4_proto = l4_proto_tmp; *il4_proto = l4_proto_tmp;
return 0;
} }
static void hns3_set_l2l3l4_len(struct sk_buff *skb, u8 ol4_proto, static void hns3_set_l2l3l4_len(struct sk_buff *skb, u8 ol4_proto,
...@@ -757,7 +761,9 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, ...@@ -757,7 +761,9 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv,
protocol = vlan_get_protocol(skb); protocol = vlan_get_protocol(skb);
skb->protocol = protocol; skb->protocol = protocol;
} }
hns3_get_l4_protocol(skb, &ol4_proto, &il4_proto); ret = hns3_get_l4_protocol(skb, &ol4_proto, &il4_proto);
if (ret)
return ret;
hns3_set_l2l3l4_len(skb, ol4_proto, il4_proto, hns3_set_l2l3l4_len(skb, ol4_proto, il4_proto,
&type_cs_vlan_tso, &type_cs_vlan_tso,
&ol_type_vlan_len_msec); &ol_type_vlan_len_msec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment