lkml.org 
[lkml]   [2018]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] i40evf: remove redundant array comparisons to 0 checks
From
Date
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));
>

\
 
 \ /
  Last update: 2018-02-16 17:54    [W:0.067 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site