Commit 5c9df5fed198ad8b967f33a1e11862f2a1d08bf7

Authored by Dan Carpenter
Committed by David S. Miller
1 parent e8efcec539

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 <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

net/ax25/ax25_addr.c
... ... @@ -189,8 +189,10 @@
189 189 digi->ndigi = 0;
190 190  
191 191 while (!(buf[-1] & AX25_EBIT)) {
192   - if (d >= AX25_MAX_DIGIS) return NULL; /* Max of 6 digis */
193   - if (len < 7) return NULL; /* Short packet */
  192 + if (d >= AX25_MAX_DIGIS)
  193 + return NULL;
  194 + if (len < AX25_ADDR_LEN)
  195 + return NULL;
194 196  
195 197 memcpy(&digi->calls[d], buf, AX25_ADDR_LEN);
196 198 digi->ndigi = d + 1;