mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 21:20:50 +07:00
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>
This commit is contained in:
parent
865d9f9f74
commit
6f8e4ad0ef
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user