From: Dan Carpenter Date: Wed, 4 Jul 2012 22:27:18 +0000 (+0000) Subject: small cleanup in ax25_addr_parse() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5c9df5fed198ad8b967f33a1e11862f2a1d08bf7;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git small cleanup in ax25_addr_parse() The comments were wrong here because "AX25_MAX_DIGIS" is 8 but the comments say 6. Also I've changed the "7" to "AX25_ADDR_LEN". Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c index 9162409559cf..e7c9b0ea17a1 100644 --- a/net/ax25/ax25_addr.c +++ b/net/ax25/ax25_addr.c @@ -189,8 +189,10 @@ const unsigned char *ax25_addr_parse(const unsigned char *buf, int len, digi->ndigi = 0; while (!(buf[-1] & AX25_EBIT)) { - if (d >= AX25_MAX_DIGIS) return NULL; /* Max of 6 digis */ - if (len < 7) return NULL; /* Short packet */ + if (d >= AX25_MAX_DIGIS) + return NULL; + if (len < AX25_ADDR_LEN) + return NULL; memcpy(&digi->calls[d], buf, AX25_ADDR_LEN); digi->ndigi = d + 1;