summaryrefslogtreecommitdiffstats
path: root/net/core/sock_diag.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-12-07 20:49:38 +0000
committerDavid S. Miller <davem@davemloft.net>2011-12-08 19:58:35 -0500
commit6f8e4ad0eff5117ba895122674670f9c63b6e8d8 (patch)
treeb84f9c6566a1d6b178b8ca2d021919b5c3499367 /net/core/sock_diag.c
parent865d9f9f748fdc1943679ea65d9ee1dc55e4a6ae (diff)
downloadop-kernel-dev-6f8e4ad0eff5117ba895122674670f9c63b6e8d8.zip
op-kernel-dev-6f8e4ad0eff5117ba895122674670f9c63b6e8d8.tar.gz
sock_diag: off by one checks
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>
Diffstat (limited to 'net/core/sock_diag.c')
-rw-r--r--net/core/sock_diag.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c
index fbaf01c..9c27bcd 100644
--- a/net/core/sock_diag.c
+++ b/net/core/sock_diag.c
@@ -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);
@@ -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);
OpenPOWER on IntegriCloud