Skip to content

Commit

Permalink
sock_diag: off by one checks
Browse files Browse the repository at this point in the history
These tests are off by one because sock_diag_handlers[] only has AF_MAX
elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Dec 9, 2011
1 parent 865d9f9 commit 6f8e4ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/sock_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int sock_diag_register(struct sock_diag_handler *hndl)
{
int err = 0;

if (hndl->family > AF_MAX)
if (hndl->family >= AF_MAX)
return -EINVAL;

mutex_lock(&sock_diag_table_mutex);
Expand All @@ -50,7 +50,7 @@ void sock_diag_unregister(struct sock_diag_handler *hnld)
{
int family = hnld->family;

if (family > AF_MAX)
if (family >= AF_MAX)
return;

mutex_lock(&sock_diag_table_mutex);
Expand Down

0 comments on commit 6f8e4ad

Please sign in to comment.