Re: [PATCH v5 2/4] scsi: mpi3mr: remove unnecessary memcpy to alltgt_info->dmi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 13, 2023 at 5:50 PM Shin'ichiro Kawasaki
<shinichiro.kawasaki@xxxxxxx> wrote:
>
> In the function mpi3mr_get_all_tgt_info, devmap_info points to
> alltgt_info->dmi then there is no need to memcpy data from devmap_info
> to alltgt_info->dmi. Remove the unnecessary memcpy. This also allows to
> remove the local variable 'rval' and the goto label 'out'.
>
> Fixes: f5e6d5a34376 ("scsi: mpi3mr: Add support for driver commands")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@xxxxxxxxxxxx>
> ---
>  drivers/scsi/mpi3mr/mpi3mr_app.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c
> index 72054e3a26cb..bff637702397 100644
> --- a/drivers/scsi/mpi3mr/mpi3mr_app.c
> +++ b/drivers/scsi/mpi3mr/mpi3mr_app.c
> @@ -293,7 +293,6 @@ static long mpi3mr_bsg_pel_enable(struct mpi3mr_ioc *mrioc,
>  static long mpi3mr_get_all_tgt_info(struct mpi3mr_ioc *mrioc,
>         struct bsg_job *job)
>  {
> -       long rval = -EINVAL;
>         u16 num_devices = 0, i = 0, size;
>         unsigned long flags;
>         struct mpi3mr_tgt_dev *tgtdev;
> @@ -304,7 +303,7 @@ static long mpi3mr_get_all_tgt_info(struct mpi3mr_ioc *mrioc,
>         if (job->request_payload.payload_len < sizeof(u32)) {
>                 dprint_bsg_err(mrioc, "%s: invalid size argument\n",
>                     __func__);
> -               return rval;
> +               return -EINVAL;
>         }
>
>         spin_lock_irqsave(&mrioc->tgtdev_lock, flags);
> @@ -350,20 +349,12 @@ static long mpi3mr_get_all_tgt_info(struct mpi3mr_ioc *mrioc,
>                 sizeof(*devmap_info);
>         usr_entrylen *= sizeof(*devmap_info);
>         min_entrylen = min(usr_entrylen, kern_entrylen);
> -       if (min_entrylen && (!memcpy(&alltgt_info->dmi, devmap_info, min_entrylen))) {
> -               dprint_bsg_err(mrioc, "%s:%d: device map info copy failed\n",
> -                   __func__, __LINE__);
> -               rval = -EFAULT;
> -               goto out;
> -       }
>
>         sg_copy_from_buffer(job->request_payload.sg_list,
>                             job->request_payload.sg_cnt,
>                             alltgt_info, (min_entrylen + sizeof(u64)));
> -       rval = 0;
> -out:
>         kfree(alltgt_info);
> -       return rval;
> +       return 0;
>  }
>  /**
>   * mpi3mr_get_change_count - Get topology change count
> --
> 2.38.1
>

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux