netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Edward Cree <ecree@solarflare.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Solarflare linux maintainers <linux-net-drivers@solarflare.com>
Cc: Bert Kenward <bkenward@solarflare.com>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch net-next] sfc: a couple off by one bugs
Date: Wed, 1 Feb 2017 13:34:49 +0000	[thread overview]
Message-ID: <d0791f09-a575-de0c-323c-e24f2cfe7dba@canonical.com> (raw)
In-Reply-To: <60d163b6-0b49-172f-288c-e1712e04a84e@solarflare.com>

On 01/02/17 13:24, Edward Cree wrote:
> On 01/02/17 08:50, Dan Carpenter wrote:
>> 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>
> One of these was already fixed by Colin Ian King in
> e9904990e8e70a51574e6ec6b872f3c705ec75f0 ("sfc: fix an off-by-one compare on an
> array size").

Ugh, I missed one of those.

> For the other one:
> Acked-by: Edward Cree <ecree@solarflare.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;
>>               }
> 
> 
> The information contained in this message is confidential and is intended for the addressee(s) only. If you have received this message in error, please notify the sender immediately and delete the message. Unless you are an addressee (or authorized to receive for an addressee), you may not use, copy or disclose to anyone this message or any information contained in this message. The unauthorized use, disclosure, copying or alteration of this message is strictly prohibited.
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2017-02-01 13:36 UTC|newest]

Thread overview: 7+ 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 13:24 ` Edward Cree
2017-02-01 13:34   ` Colin Ian King [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 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=d0791f09-a575-de0c-323c-e24f2cfe7dba@canonical.com \
    --to=colin.king@canonical.com \
    --cc=bkenward@solarflare.com \
    --cc=dan.carpenter@oracle.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).