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]
Message-ID: <CACGkMEts+u6gnm1hsT=vhgiHE5CiYns4mydTtnr3LkZMJEzVGA@mail.gmail.com>
Date:   Wed, 27 Apr 2022 12:22:40 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Zhu Lingshan <lingshan.zhu@...el.com>
Cc:     mst <mst@...hat.com>,
        virtualization <virtualization@...ts.linux-foundation.org>,
        netdev <netdev@...r.kernel.org>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] vDPA/ifcvf: fix uninitialized config_vector warning

On Sun, Apr 24, 2022 at 3:36 PM Zhu Lingshan <lingshan.zhu@...el.com> wrote:
>
> Static checkers are not informed that config_vector is controlled
> by vf->msix_vector_status, which can only be
> MSIX_VECTOR_SHARED_VQ_AND_CONFIG, MSIX_VECTOR_SHARED_VQ_AND_CONFIG
> and MSIX_VECTOR_DEV_SHARED.
>
> This commit uses an "if...elseif...else" code block to tell the
> checkers that it is a complete set, and config_vector can be
> initialized anyway
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@...el.com>
> Reviewed-by: Dan Carpenter <dan.carpenter@...cle.com>

Acked-by: Jason Wang <jasowang@...hat.com>

> ---
>  drivers/vdpa/ifcvf/ifcvf_main.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index 4366320fb68d..9172905fc7ae 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -290,16 +290,16 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter)
>         struct ifcvf_hw *vf = &adapter->vf;
>         int config_vector, ret;
>
> -       if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
> -               return 0;
> -
>         if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
> -               /* vector 0 ~ vf->nr_vring for vqs, num vf->nr_vring vector for config interrupt */
>                 config_vector = vf->nr_vring;
> -
> -       if (vf->msix_vector_status ==  MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
> +       else if (vf->msix_vector_status ==  MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
>                 /* vector 0 for vqs and 1 for config interrupt */
>                 config_vector = 1;
> +       else if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
> +               /* re-use the vqs vector */
> +               return 0;
> +       else
> +               return -EINVAL;
>
>         snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
>                  pci_name(pdev));
> --
> 2.31.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ