lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 19 Feb 2018 15:40:30 +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][V2] i40evf: remove redundant array comparisons to 0 checks

On Mon, Feb 19, 2018 at 12:23 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.   Also replace filter->f with vf, allowing wide lines to be
> condensed and to rejoin some split wide lines.
>
> Detected by CoverityScan, CID#1465279 ("Array compared to 0")
>
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---

Changelog?


>         u16 addr_type = 0;
>         u16 n_proto = 0;
>         int i = 0;
> +       struct virtchnl_filter *vf = &filter->f;
>

Perhaps perserve reversed xmas tree order?


> -                       filter->f.flow_type = VIRTCHNL_TCP_V6_FLOW;
> +                       vf->flow_type = VIRTCHNL_TCP_V6_FLOW;

No need to touch.

>                 }
>
>                 if (key->ip_proto != IPPROTO_TCP) {
> @@ -2585,9 +2586,8 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
>                             is_multicast_ether_addr(key->dst)) {
>                                 /* set the mask if a valid dst_mac address */
>                                 for (i = 0; i < ETH_ALEN; i++)
> -                                       filter->f.mask.tcp_spec.dst_mac[i] |=
> -                                                                       0xff;
> -                               ether_addr_copy(filter->f.data.tcp_spec.dst_mac,
> +                                       vf->mask.tcp_spec.dst_mac[i] |= 0xff;
> +                               ether_addr_copy(vf->data.tcp_spec.dst_mac,
>                                                 key->dst);

Instead, keep two pointers:
 ... *pointer_mask = &vf->mask.tcp_spec;
 ... *pointer_data = &vf->data.tcp_spec;


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists