All of lore.kernel.org
 help / color / mirror / Atom feed
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 v2 net-next] sfc: fix an off by one bug
Date: Tue, 07 Feb 2017 07:44:31 +0000	[thread overview]
Message-ID: <20170207074431.GA18377@mwanda> (raw)
In-Reply-To: <60d163b6-0b49-172f-288c-e1712e04a84e@solarflare.com>

This bug is harmless because it's just a sanity check and we always
pass valid values for "encap_type" but the test is off by one.

Fixes: 9b4108012517 ("sfc: insert catch-all filters for encapsulated traffic")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Rebased against last linux-next

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 0475f1831b92..dec0c8083ff3 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -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;
 		}

WARNING: multiple messages have this Message-ID (diff)
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 v2 net-next] sfc: fix an off by one bug
Date: Tue, 7 Feb 2017 10:44:31 +0300	[thread overview]
Message-ID: <20170207074431.GA18377@mwanda> (raw)
In-Reply-To: <60d163b6-0b49-172f-288c-e1712e04a84e@solarflare.com>

This bug is harmless because it's just a sanity check and we always
pass valid values for "encap_type" but the test is off by one.

Fixes: 9b4108012517 ("sfc: insert catch-all filters for encapsulated traffic")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Rebased against last linux-next

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 0475f1831b92..dec0c8083ff3 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -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;
 		}

  parent reply	other threads:[~2017-02-07  7:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01  8:50 [patch net-next] sfc: a couple off by one bugs Dan Carpenter
2017-02-01  8:50 ` Dan Carpenter
2017-02-01 13:24 ` Edward Cree
2017-02-01 13:24   ` Edward Cree
2017-02-01 13:34   ` Colin Ian King
2017-02-01 13:34     ` Colin Ian King
2017-02-07  7:44   ` Dan Carpenter [this message]
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  8:43       ` Bert Kenward
2017-02-07 19:00     ` David Miller
2017-02-07 19:00       ` David Miller
2017-02-01 17:44 ` [patch net-next] sfc: a couple off by one bugs David Miller
2017-02-01 17:44   ` 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=20170207074431.GA18377@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.