From: Colin Ian King <colin.king@canonical.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
intel-wired-lan@lists.osuosl.org, netdev <netdev@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
Date: Fri, 16 Feb 2018 16:53:21 +0000 [thread overview]
Message-ID: <eb8a38bd-73a0-5f44-5e89-d9ded5be1800@canonical.com> (raw)
In-Reply-To: <CAHp75Vcxt0kkzRaF1Zzkt4hVqcPt0VG61yTLgB7HvG1xwhPUbg@mail.gmail.com>
On 16/02/18 16:51, Andy Shevchenko wrote:
> On Thu, Feb 15, 2018 at 9:42 PM, Colin King <colin.king@canonical.com> wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The checks to see if key->dst.s6_addr and key->src.s6_addr are null
>> pointers are redundant because these are constant size arrays and
>> so the checks always return true. Fix this by removing the redundant
>> checks.
>
>> + for (i = 0; i < 4; i++)
>
>> + filter->f.mask.tcp_spec.dst_ip[i] |=
>> cpu_to_be32(0xffffffff);
>
> Can it be one line then?
I re-adjusted the text because checkpatch was complaining.
>
>> + memcpy(&filter->f.data.tcp_spec.dst_ip,
>> + &key->dst.s6_addr32,
>
> Ditto.
>
>> + sizeof(filter->f.data.tcp_spec.dst_ip));
>> +
>> + for (i = 0; i < 4; i++)
>
>> + filter->f.mask.tcp_spec.src_ip[i] |=
>> cpu_to_be32(0xffffffff);
>
> Ditto.
>
>> + memcpy(&filter->f.data.tcp_spec.src_ip,
>> + &key->src.s6_addr32,
>
> Ditto.
>
>> + sizeof(filter->f.data.tcp_spec.src_ip));
>
next prev parent reply other threads:[~2018-02-16 16:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 19:42 Colin King
2018-02-16 16:51 ` Andy Shevchenko
2018-02-16 16:53 ` Colin Ian King [this message]
2018-02-18 14:58 ` Andy Shevchenko
2018-02-18 16:31 ` Joe Perches
2018-02-18 19:00 ` Colin Ian King
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=eb8a38bd-73a0-5f44-5e89-d9ded5be1800@canonical.com \
--to=colin.king@canonical.com \
--cc=andy.shevchenko@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®