From: Dan Carpenter <dan.carpenter@oracle.com>
To: Solarflare linux maintainers <linux-net-drivers@solarflare.com>,
Edward Cree <ecree@solarflare.com>
Cc: Bert Kenward <bkenward@solarflare.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch net-next] sfc: a couple off by one bugs
Date: Wed, 1 Feb 2017 11:50:40 +0300 [thread overview]
Message-ID: <20170201085040.GA31514@mwanda> (raw)
These checks are off by one. These are just sanity checks and we don't
ever pass invalid values for "encap_type" so it's harmless.
Fixes: 9b4108012517 ("sfc: insert catch-all filters for encapsulated traffic")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 8bec9383d754..dec0c8083ff3 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -5080,7 +5080,7 @@ static int efx_ef10_filter_insert_def(struct efx_nic *efx,
/* quick bounds check (BCAST result impossible) */
BUILD_BUG_ON(EFX_EF10_BCAST != 0);
- if (encap_type > ARRAY_SIZE(map) || map[encap_type] == 0) {
+ if (encap_type >= ARRAY_SIZE(map) || map[encap_type] == 0) {
WARN_ON(1);
return -EINVAL;
}
@@ -5134,7 +5134,7 @@ static int efx_ef10_filter_insert_def(struct efx_nic *efx,
/* quick bounds check (BCAST result impossible) */
BUILD_BUG_ON(EFX_EF10_BCAST != 0);
- if (encap_type > ARRAY_SIZE(map) || map[encap_type] == 0) {
+ if (encap_type >= ARRAY_SIZE(map) || map[encap_type] == 0) {
WARN_ON(1);
return -EINVAL;
}
next reply other threads:[~2017-02-01 8:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 8:50 Dan Carpenter [this message]
2017-02-01 13:24 ` [patch net-next] sfc: a couple off by one bugs Edward Cree
2017-02-01 13:34 ` Colin Ian King
2017-02-07 7:44 ` [patch v2 net-next] sfc: fix an off by one bug Dan Carpenter
2017-02-07 8:43 ` Bert Kenward
2017-02-07 19:00 ` David Miller
2017-02-01 17:44 ` [patch net-next] sfc: a couple off by one bugs 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=20170201085040.GA31514@mwanda \
--to=dan.carpenter@oracle.com \
--cc=bkenward@solarflare.com \
--cc=ecree@solarflare.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-net-drivers@solarflare.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).