[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vcxt0kkzRaF1Zzkt4hVqcPt0VG61yTLgB7HvG1xwhPUbg@mail.gmail.com>
Date: Fri, 16 Feb 2018 18:51:57 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Colin King <colin.king@...onical.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
intel-wired-lan@...ts.osuosl.org, netdev <netdev@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
On Thu, Feb 15, 2018 at 9:42 PM, Colin King <colin.king@...onical.com> wrote:
> From: Colin Ian King <colin.king@...onical.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?
> + 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));
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists