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>
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 err = 0;
- if (hndl->family > AF_MAX)
+ if (hndl->family >= AF_MAX)
return -EINVAL;
mutex_lock(&sock_diag_table_mutex);
@@ -50,7 +50,7 @@
{
int family = hnld->family;
- if (family > AF_MAX)
+ if (family >= AF_MAX)
return;
mutex_lock(&sock_diag_table_mutex);