Thread (6 messages) 6 messages, 3 authors, 2018-02-18

Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks

From: Colin Ian King <hidden>
Date: 2018-02-16 16:53:27
Also in: intel-wired-lan, kernel-janitors, lkml

On 16/02/18 16:51, Andy Shevchenko wrote:
On Thu, Feb 15, 2018 at 9:42 PM, Colin King [off-list ref] wrote:
quoted
From: Colin Ian King <redacted>

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.
quoted
+               for (i = 0; i < 4; i++)
quoted
+                       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.
quoted
+               memcpy(&filter->f.data.tcp_spec.dst_ip,
+                      &key->dst.s6_addr32,
Ditto.
quoted
+                      sizeof(filter->f.data.tcp_spec.dst_ip));
+
+               for (i = 0; i < 4; i++)
quoted
+                       filter->f.mask.tcp_spec.src_ip[i] |=
                                                        cpu_to_be32(0xffffffff);
Ditto.
quoted
+               memcpy(&filter->f.data.tcp_spec.src_ip,
+                      &key->src.s6_addr32,
Ditto.
quoted
+                      sizeof(filter->f.data.tcp_spec.src_ip));
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help