提交 6f8e4ad0 编写于 作者: D Dan Carpenter 提交者: David S. Miller

sock_diag: off by one checks

These tests are off by one because sock_diag_handlers[] only has AF_MAX
elements.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NPavel Emelyanov <xemul@parallels.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 865d9f9f
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册