* [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-15 19:42 ` Colin King
0 siblings, 0 replies; 19+ messages in thread
From: Colin King @ 2018-02-15 19:42 UTC (permalink / raw)
To: Jeff Kirsher, intel-wired-lan, netdev; +Cc: kernel-janitors, linux-kernel
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.
Detected by CoverityScan, CID#1465279 ("Array compared to 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 4955ce3ab6a2..63e4169828ea 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -2710,22 +2710,19 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
if (!ipv6_addr_any(&mask->dst) || !ipv6_addr_any(&mask->src))
field_flags |= I40EVF_CLOUD_FIELD_IIP;
- if (key->dst.s6_addr) {
- for (i = 0; i < 4; i++)
- filter->f.mask.tcp_spec.dst_ip[i] |=
+ for (i = 0; i < 4; i++)
+ filter->f.mask.tcp_spec.dst_ip[i] |=
cpu_to_be32(0xffffffff);
- memcpy(&filter->f.data.tcp_spec.dst_ip,
- &key->dst.s6_addr32,
- sizeof(filter->f.data.tcp_spec.dst_ip));
- }
- if (key->src.s6_addr) {
- for (i = 0; i < 4; i++)
- filter->f.mask.tcp_spec.src_ip[i] |=
+ memcpy(&filter->f.data.tcp_spec.dst_ip,
+ &key->dst.s6_addr32,
+ 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);
- memcpy(&filter->f.data.tcp_spec.src_ip,
- &key->src.s6_addr32,
- sizeof(filter->f.data.tcp_spec.src_ip));
- }
+ memcpy(&filter->f.data.tcp_spec.src_ip,
+ &key->src.s6_addr32,
+ sizeof(filter->f.data.tcp_spec.src_ip));
}
if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_PORTS)) {
struct flow_dissector_key_ports *key =
--
2.15.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-15 19:42 ` Colin King
0 siblings, 0 replies; 19+ messages in thread
From: Colin King @ 2018-02-15 19:42 UTC (permalink / raw)
To: Jeff Kirsher, intel-wired-lan, netdev; +Cc: kernel-janitors, linux-kernel
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.
Detected by CoverityScan, CID#1465279 ("Array compared to 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 4955ce3ab6a2..63e4169828ea 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -2710,22 +2710,19 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
if (!ipv6_addr_any(&mask->dst) || !ipv6_addr_any(&mask->src))
field_flags |= I40EVF_CLOUD_FIELD_IIP;
- if (key->dst.s6_addr) {
- for (i = 0; i < 4; i++)
- filter->f.mask.tcp_spec.dst_ip[i] |+ for (i = 0; i < 4; i++)
+ filter->f.mask.tcp_spec.dst_ip[i] | cpu_to_be32(0xffffffff);
- memcpy(&filter->f.data.tcp_spec.dst_ip,
- &key->dst.s6_addr32,
- sizeof(filter->f.data.tcp_spec.dst_ip));
- }
- if (key->src.s6_addr) {
- for (i = 0; i < 4; i++)
- filter->f.mask.tcp_spec.src_ip[i] |+ memcpy(&filter->f.data.tcp_spec.dst_ip,
+ &key->dst.s6_addr32,
+ 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);
- memcpy(&filter->f.data.tcp_spec.src_ip,
- &key->src.s6_addr32,
- sizeof(filter->f.data.tcp_spec.src_ip));
- }
+ memcpy(&filter->f.data.tcp_spec.src_ip,
+ &key->src.s6_addr32,
+ sizeof(filter->f.data.tcp_spec.src_ip));
}
if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_PORTS)) {
struct flow_dissector_key_ports *key --
2.15.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-15 19:42 ` Colin King
0 siblings, 0 replies; 19+ messages in thread
From: Colin King @ 2018-02-15 19:42 UTC (permalink / raw)
To: intel-wired-lan
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.
Detected by CoverityScan, CID#1465279 ("Array compared to 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 4955ce3ab6a2..63e4169828ea 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -2710,22 +2710,19 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
if (!ipv6_addr_any(&mask->dst) || !ipv6_addr_any(&mask->src))
field_flags |= I40EVF_CLOUD_FIELD_IIP;
- if (key->dst.s6_addr) {
- for (i = 0; i < 4; i++)
- filter->f.mask.tcp_spec.dst_ip[i] |=
+ for (i = 0; i < 4; i++)
+ filter->f.mask.tcp_spec.dst_ip[i] |=
cpu_to_be32(0xffffffff);
- memcpy(&filter->f.data.tcp_spec.dst_ip,
- &key->dst.s6_addr32,
- sizeof(filter->f.data.tcp_spec.dst_ip));
- }
- if (key->src.s6_addr) {
- for (i = 0; i < 4; i++)
- filter->f.mask.tcp_spec.src_ip[i] |=
+ memcpy(&filter->f.data.tcp_spec.dst_ip,
+ &key->dst.s6_addr32,
+ 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);
- memcpy(&filter->f.data.tcp_spec.src_ip,
- &key->src.s6_addr32,
- sizeof(filter->f.data.tcp_spec.src_ip));
- }
+ memcpy(&filter->f.data.tcp_spec.src_ip,
+ &key->src.s6_addr32,
+ sizeof(filter->f.data.tcp_spec.src_ip));
}
if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_PORTS)) {
struct flow_dissector_key_ports *key =
--
2.15.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: remove redundant array comparisons to 0 checks
2018-02-15 19:42 ` Colin King
(?)
(?)
@ 2018-02-15 22:39 ` Ramamurthy, Harshitha
-1 siblings, 0 replies; 19+ messages in thread
From: Ramamurthy, Harshitha @ 2018-02-15 22:39 UTC (permalink / raw)
To: intel-wired-lan
On Thu, 2018-02-15 at 19:42 +0000, Colin King 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.
>
> Detected by CoverityScan, CID#1465279 ("Array compared to 0")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Harshitha Ramamurthy <harshitha.ramamurthy@intel.com>
> ---
> ?drivers/net/ethernet/intel/i40evf/i40evf_main.c | 25 +++++++++++--
> ------------
> ?1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
> b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
> index 4955ce3ab6a2..63e4169828ea 100644
> --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
> +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
> @@ -2710,22 +2710,19 @@ static int i40evf_parse_cls_flower(struct
> i40evf_adapter *adapter,
> ? if (!ipv6_addr_any(&mask->dst) ||
> !ipv6_addr_any(&mask->src))
> ? field_flags |= I40EVF_CLOUD_FIELD_IIP;
> ?
> - if (key->dst.s6_addr) {
> - for (i = 0; i < 4; i++)
> - filter->f.mask.tcp_spec.dst_ip[i] |=
> + for (i = 0; i < 4; i++)
> + filter->f.mask.tcp_spec.dst_ip[i] |=
> ? cpu_to_be32(
> 0xffffffff);
> - memcpy(&filter->f.data.tcp_spec.dst_ip,
> - ???????&key->dst.s6_addr32,
> - ???????sizeof(filter-
> >f.data.tcp_spec.dst_ip));
> - }
> - if (key->src.s6_addr) {
> - for (i = 0; i < 4; i++)
> - filter->f.mask.tcp_spec.src_ip[i] |=
> + memcpy(&filter->f.data.tcp_spec.dst_ip,
> + ???????&key->dst.s6_addr32,
> + ???????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);
> - memcpy(&filter->f.data.tcp_spec.src_ip,
> - ???????&key->src.s6_addr32,
> - ???????sizeof(filter-
> >f.data.tcp_spec.src_ip));
> - }
> + memcpy(&filter->f.data.tcp_spec.src_ip,
> + ???????&key->src.s6_addr32,
> + ???????sizeof(filter->f.data.tcp_spec.src_ip));
> ? }
> ? if (dissector_uses_key(f->dissector,
> FLOW_DISSECTOR_KEY_PORTS)) {
> ? struct flow_dissector_key_ports *key =
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
2018-02-15 19:42 ` Colin King
(?)
@ 2018-02-16 16:51 ` Andy Shevchenko
-1 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2018-02-16 16:51 UTC (permalink / raw)
To: Colin King
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
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?
> + 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
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-16 16:51 ` Andy Shevchenko
0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2018-02-16 16:51 UTC (permalink / raw)
To: Colin King
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
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?
> + 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
^ permalink raw reply [flat|nested] 19+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-16 16:51 ` Andy Shevchenko
0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2018-02-16 16:51 UTC (permalink / raw)
To: intel-wired-lan
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?
> + 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
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
2018-02-16 16:51 ` Andy Shevchenko
(?)
@ 2018-02-16 16:53 ` Colin Ian King
-1 siblings, 0 replies; 19+ messages in thread
From: Colin Ian King @ 2018-02-16 16:53 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
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));
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-16 16:53 ` Colin Ian King
0 siblings, 0 replies; 19+ messages in thread
From: Colin Ian King @ 2018-02-16 16:53 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
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));
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-16 16:53 ` Colin Ian King
0 siblings, 0 replies; 19+ messages in thread
From: Colin Ian King @ 2018-02-16 16:53 UTC (permalink / raw)
To: intel-wired-lan
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));
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
2018-02-16 16:53 ` Colin Ian King
(?)
@ 2018-02-18 14:58 ` Andy Shevchenko
-1 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2018-02-18 14:58 UTC (permalink / raw)
To: Colin Ian King
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
<colin.king@canonical.com> wrote:
> 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:
>>> + 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.
>>
>>> + filter->f.mask.tcp_spec.src_ip[i] |=
>>> cpu_to_be32(0xffffffff);
For the rest OK, but for the above two how much over 80 it went if
would be one line?
If it 2-3 characters, consider to make it one line. It would increase
readability.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-18 14:58 ` Andy Shevchenko
0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2018-02-18 14:58 UTC (permalink / raw)
To: Colin Ian King
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
<colin.king@canonical.com> wrote:
> 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:
>>> + 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.
>>
>>> + filter->f.mask.tcp_spec.src_ip[i] |>>> cpu_to_be32(0xffffffff);
For the rest OK, but for the above two how much over 80 it went if
would be one line?
If it 2-3 characters, consider to make it one line. It would increase
readability.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 19+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-18 14:58 ` Andy Shevchenko
0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2018-02-18 14:58 UTC (permalink / raw)
To: intel-wired-lan
On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
<colin.king@canonical.com> wrote:
> 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:
>>> + 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.
>>
>>> + filter->f.mask.tcp_spec.src_ip[i] |=
>>> cpu_to_be32(0xffffffff);
For the rest OK, but for the above two how much over 80 it went if
would be one line?
If it 2-3 characters, consider to make it one line. It would increase
readability.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
2018-02-18 14:58 ` Andy Shevchenko
(?)
@ 2018-02-18 16:31 ` Joe Perches
-1 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2018-02-18 16:31 UTC (permalink / raw)
To: Andy Shevchenko, Colin Ian King
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
On Sun, 2018-02-18 at 16:58 +0200, Andy Shevchenko wrote:
> On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
> <colin.king@canonical.com> wrote:
> > 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:
> > > > + 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.
> > >
> > > > + filter->f.mask.tcp_spec.src_ip[i] |=
> > > > cpu_to_be32(0xffffffff);
>
> For the rest OK, but for the above two how much over 80 it went if
> would be one line?
> If it 2-3 characters, consider to make it one line. It would increase
> readability.
Another possibility would be to use temporaries for
filter->f.mask.tcp_spec
and
filter->f.data.tcp_spec
as both are used ~10 times in the function
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-18 16:31 ` Joe Perches
0 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2018-02-18 16:31 UTC (permalink / raw)
To: Andy Shevchenko, Colin Ian King
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
On Sun, 2018-02-18 at 16:58 +0200, Andy Shevchenko wrote:
> On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
> <colin.king@canonical.com> wrote:
> > 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:
> > > > + 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.
> > >
> > > > + filter->f.mask.tcp_spec.src_ip[i] |> > > > cpu_to_be32(0xffffffff);
>
> For the rest OK, but for the above two how much over 80 it went if
> would be one line?
> If it 2-3 characters, consider to make it one line. It would increase
> readability.
Another possibility would be to use temporaries for
filter->f.mask.tcp_spec
and
filter->f.data.tcp_spec
as both are used ~10 times in the function
^ permalink raw reply [flat|nested] 19+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-18 16:31 ` Joe Perches
0 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2018-02-18 16:31 UTC (permalink / raw)
To: intel-wired-lan
On Sun, 2018-02-18 at 16:58 +0200, Andy Shevchenko wrote:
> On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
> <colin.king@canonical.com> wrote:
> > 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:
> > > > + 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.
> > >
> > > > + filter->f.mask.tcp_spec.src_ip[i] |=
> > > > cpu_to_be32(0xffffffff);
>
> For the rest OK, but for the above two how much over 80 it went if
> would be one line?
> If it 2-3 characters, consider to make it one line. It would increase
> readability.
Another possibility would be to use temporaries for
filter->f.mask.tcp_spec
and
filter->f.data.tcp_spec
as both are used ~10 times in the function
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
2018-02-18 16:31 ` Joe Perches
(?)
@ 2018-02-18 19:00 ` Colin Ian King
-1 siblings, 0 replies; 19+ messages in thread
From: Colin Ian King @ 2018-02-18 19:00 UTC (permalink / raw)
To: Joe Perches, Andy Shevchenko
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
On 18/02/18 16:31, Joe Perches wrote:
> On Sun, 2018-02-18 at 16:58 +0200, Andy Shevchenko wrote:
>> On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
>> <colin.king@canonical.com> wrote:
>>> 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:
>>>>> + 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.
>>>>
>>>>> + filter->f.mask.tcp_spec.src_ip[i] |=
>>>>> cpu_to_be32(0xffffffff);
>>
>> For the rest OK, but for the above two how much over 80 it went if
>> would be one line?
>> If it 2-3 characters, consider to make it one line. It would increase
>> readability.
>
> Another possibility would be to use temporaries for
> filter->f.mask.tcp_spec
> and
> filter->f.data.tcp_spec
> as both are used ~10 times in the function
That's a good idea. I'll fix this up tomorrow when I get back to work
>
>
> --
> 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
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-18 19:00 ` Colin Ian King
0 siblings, 0 replies; 19+ messages in thread
From: Colin Ian King @ 2018-02-18 19:00 UTC (permalink / raw)
To: Joe Perches, Andy Shevchenko
Cc: Jeff Kirsher, intel-wired-lan, netdev, kernel-janitors,
Linux Kernel Mailing List
On 18/02/18 16:31, Joe Perches wrote:
> On Sun, 2018-02-18 at 16:58 +0200, Andy Shevchenko wrote:
>> On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
>> <colin.king@canonical.com> wrote:
>>> 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:
>>>>> + 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.
>>>>
>>>>> + filter->f.mask.tcp_spec.src_ip[i] |>>>>> cpu_to_be32(0xffffffff);
>>
>> For the rest OK, but for the above two how much over 80 it went if
>> would be one line?
>> If it 2-3 characters, consider to make it one line. It would increase
>> readability.
>
> Another possibility would be to use temporaries for
> filter->f.mask.tcp_spec
> and
> filter->f.data.tcp_spec
> as both are used ~10 times in the function
That's a good idea. I'll fix this up tomorrow when I get back to work
>
>
> --
> 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
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: remove redundant array comparisons to 0 checks
@ 2018-02-18 19:00 ` Colin Ian King
0 siblings, 0 replies; 19+ messages in thread
From: Colin Ian King @ 2018-02-18 19:00 UTC (permalink / raw)
To: intel-wired-lan
On 18/02/18 16:31, Joe Perches wrote:
> On Sun, 2018-02-18 at 16:58 +0200, Andy Shevchenko wrote:
>> On Fri, Feb 16, 2018 at 6:53 PM, Colin Ian King
>> <colin.king@canonical.com> wrote:
>>> 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:
>>>>> + 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.
>>>>
>>>>> + filter->f.mask.tcp_spec.src_ip[i] |=
>>>>> cpu_to_be32(0xffffffff);
>>
>> For the rest OK, but for the above two how much over 80 it went if
>> would be one line?
>> If it 2-3 characters, consider to make it one line. It would increase
>> readability.
>
> Another possibility would be to use temporaries for
> filter->f.mask.tcp_spec
> and
> filter->f.data.tcp_spec
> as both are used ~10 times in the function
That's a good idea. I'll fix this up tomorrow when I get back to work
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2018-02-18 19:00 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15 19:42 [PATCH] i40evf: remove redundant array comparisons to 0 checks Colin King
2018-02-15 19:42 ` [Intel-wired-lan] " Colin King
2018-02-15 19:42 ` Colin King
2018-02-15 22:39 ` [Intel-wired-lan] " Ramamurthy, Harshitha
2018-02-16 16:51 ` Andy Shevchenko
2018-02-16 16:51 ` [Intel-wired-lan] " Andy Shevchenko
2018-02-16 16:51 ` Andy Shevchenko
2018-02-16 16:53 ` Colin Ian King
2018-02-16 16:53 ` [Intel-wired-lan] " Colin Ian King
2018-02-16 16:53 ` Colin Ian King
2018-02-18 14:58 ` Andy Shevchenko
2018-02-18 14:58 ` [Intel-wired-lan] " Andy Shevchenko
2018-02-18 14:58 ` Andy Shevchenko
2018-02-18 16:31 ` Joe Perches
2018-02-18 16:31 ` [Intel-wired-lan] " Joe Perches
2018-02-18 16:31 ` Joe Perches
2018-02-18 19:00 ` Colin Ian King
2018-02-18 19:00 ` [Intel-wired-lan] " Colin Ian King
2018-02-18 19:00 ` Colin Ian King
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.