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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL2rwxrdOVeO3RT_Y3mk3p-076eMMWm6VVF0C4yiYEWJ0TO5DQ@mail.gmail.com>
Date:   Tue, 5 Nov 2019 14:58:35 +0530
From:   Sumit Saxena <sumit.saxena@...adcom.com>
To:     Markus Elfring <Markus.Elfring@....de>
Cc:     Linux SCSI List <linux-scsi@...r.kernel.org>,
        "PDL,MEGARAIDLINUX" <megaraidlinux.pdl@...adcom.com>,
        "James E. J. Bottomley" <jejb@...ux.ibm.com>,
        Kashyap Desai <kashyap.desai@...adcom.com>,
        Shivasharan S <shivasharan.srikanteshwara@...adcom.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Chandrakanth Patil <chandrakanth.patil@...adcom.com>,
        YueHaibing <yuehaibing@...wei.com>
Subject: Re: [PATCH] scsi: megaraid_sas: Use common error handling code in megasas_mgmt_ioctl_fw()

On Fri, Nov 1, 2019 at 3:06 AM Markus Elfring <Markus.Elfring@....de> wrote:
>
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Thu, 31 Oct 2019 22:23:02 +0100
>
> Move the same error code assignments so that such exception handling
> can be better reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>

Acked-by: Sumit Saxena <sumit.saxena@...adcom.com>

> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 25 ++++++++++-------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index c40fbea06cc5..f2f2a240e5af 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -8272,27 +8272,20 @@ static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
>                 return PTR_ERR(ioc);
>
>         instance = megasas_lookup_instance(ioc->host_no);
> -       if (!instance) {
> -               error = -ENODEV;
> -               goto out_kfree_ioc;
> -       }
> +       if (!instance)
> +               goto e_nodev;
>
>         /* Block ioctls in VF mode */
> -       if (instance->requestorId && !allow_vf_ioctls) {
> -               error = -ENODEV;
> -               goto out_kfree_ioc;
> -       }
> +       if (instance->requestorId && !allow_vf_ioctls)
> +               goto e_nodev;
>
>         if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) {
>                 dev_err(&instance->pdev->dev, "Controller in crit error\n");
> -               error = -ENODEV;
> -               goto out_kfree_ioc;
> +               goto e_nodev;
>         }
>
> -       if (instance->unload == 1) {
> -               error = -ENODEV;
> -               goto out_kfree_ioc;
> -       }
> +       if (instance->unload == 1)
> +               goto e_nodev;
>
>         if (down_interruptible(&instance->ioctl_sem)) {
>                 error = -ERESTARTSYS;
> @@ -8311,6 +8304,10 @@ static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
>  out_kfree_ioc:
>         kfree(ioc);
>         return error;
> +
> +e_nodev:
> +       error = -ENODEV;
> +       goto out_kfree_ioc;
>  }
>
>  static int megasas_mgmt_ioctl_aen(struct file *file, unsigned long arg)
> --
> 2.23.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ