From: Miaohe Lin Date: Mon, 24 Aug 2020 11:15:04 +0000 (-0400) Subject: net: Avoid access icmp_err_convert when icmp code is ICMP_FRAG_NEEDED X-Git-Tag: v5.15~2655^2~451 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=755114497815bd0931e2d0e95c5aa969dcf4aa25;p=platform%2Fkernel%2Flinux-starfive.git net: Avoid access icmp_err_convert when icmp code is ICMP_FRAG_NEEDED There is no need to fetch errno and fatal info from icmp_err_convert when icmp code is ICMP_FRAG_NEEDED. Signed-off-by: Miaohe Lin Signed-off-by: David S. Miller --- diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1eb936f..dfba394 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -260,11 +260,12 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info) err = EHOSTUNREACH; if (code > NR_ICMP_UNREACH) break; - err = icmp_err_convert[code].errno; - harderr = icmp_err_convert[code].fatal; if (code == ICMP_FRAG_NEEDED) { harderr = inet->pmtudisc != IP_PMTUDISC_DONT; err = EMSGSIZE; + } else { + err = icmp_err_convert[code].errno; + harderr = icmp_err_convert[code].fatal; } }