Skip to content

Commit

Permalink
6lowpan: iphc: fix invalid case handling
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Alexander Aring <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
Alexander Aring authored and holtmann committed Feb 26, 2016
1 parent 395174b commit 2306f65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/6lowpan/iphc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2306f65

Please sign in to comment.