From: Alexander Aring Date: Fri, 26 Feb 2016 08:06:07 +0000 (+0100) Subject: 6lowpan: iphc: fix invalid case handling X-Git-Tag: v4.9.8~2476^2~138^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2306f65637079c8922aec15b4ced75ea457e757b;p=platform%2Fkernel%2Flinux-rpi3.git 6lowpan: iphc: fix invalid case handling This patch fixes the return value in a case which should never occur. Instead returning "-EINVAL" we return LOWPAN_IPHC_DAM_00 which is invalid on context based addresses. Also change the WARN_ON_ONCE to WARN_ONCE which was suggested by Dan Carpenter. Reported-by: Dan Carpenter Signed-off-by: Alexander Aring Signed-off-by: Marcel Holtmann --- diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c index 06287ac..7217251 100644 --- a/net/6lowpan/iphc.c +++ b/net/6lowpan/iphc.c @@ -811,8 +811,8 @@ static u8 lowpan_compress_ctx_addr(u8 **hc_ptr, const struct in6_addr *ipaddr, goto out; } - WARN_ON_ONCE("context found but no address mode matched\n"); - return -EINVAL; + WARN_ONCE(1, "context found but no address mode matched\n"); + return LOWPAN_IPHC_DAM_00; out: if (sam)