From: Dan Carpenter <dan.carpenter@oracle.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Pavel Emelyanov <xemul@parallels.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] sock_diag: off by one checks
Date: Thu, 08 Dec 2011 06:49:38 +0000 [thread overview]
Message-ID: <20111208064938.GB16735@elgon.mountain> (raw)
These tests are off by one because sock_diag_handlers[] only has AF_MAX
elements.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
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);
next reply other threads:[~2011-12-08 6:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-08 6:49 Dan Carpenter [this message]
2011-12-08 9:07 ` [patch] sock_diag: off by one checks Pavel Emelyanov
2011-12-09 0:54 ` David Miller
2011-12-09 0:54 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111208064938.GB16735@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=xemul@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox