diff mbox

[bluetooth-next] 6lowpan: iphc: fix invalid case handling

Message ID 1456473967-26721-1-git-send-email-aar@pengutronix.de (mailing list archive)
State Accepted
Headers show

Commit Message

Alexander Aring Feb. 26, 2016, 8:06 a.m. UTC
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 <dan.carpenter@oracle.com>
Signed-off-by: Alexander Aring <aar@pengutronix.de>
---
 net/6lowpan/iphc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marcel Holtmann Feb. 26, 2016, 8:12 a.m. UTC | #1
Hi Alex,

> 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 <dan.carpenter@oracle.com>
> Signed-off-by: Alexander Aring <aar@pengutronix.de>
> ---
> net/6lowpan/iphc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)