sock_diag: off by one checks
Subsystems (4)
PATCH 1/1 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 <[email protected]>
net/core/sock_diag.c +2 -2
@@ -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);
Quoted 2 lines · Dan Carpenter
These tests are off by one because sock_diag_handlers[] only has
AF_MAXelements.
Oops :(
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>
Acked-by Pavel Emelyanov <[email protected]>
Quoted 23 lines
net/core/sock_diag.c +2
-2@@ -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);
From: Pavel Emelyanov <[email protected]>
Date: Thu, 08 Dec 2011 13:07:55 +0400
Quoted 9 lines · Dan Carpenter
Quoted 2 lines
These tests are off by one because sock_diag_handlers[] only has
AF_MAXelements.Oops :(
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>Acked-by Pavel Emelyanov <[email protected]>
Applied.
From: Dan Carpenter <[email protected]>
Date: Thu, 8 Dec 2011 09:49:38 +0300
Quoted 4 lines
These tests are off by one because sock_diag_handlers[] only has
AF_MAXelements.Signed-off-by Dan Carpenter <[email protected]>
Applied.