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: <CAPDyKFp6h_DAcDvDEMft_WApEakdPQiMw0v8t2fPVxS+H1KkOA@mail.gmail.com>
Date:   Mon, 30 Oct 2017 12:40:39 +0100
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        Linux USB List <linux-usb@...r.kernel.org>,
        Tony Olech <tony.olech@...ndigitalsystems.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] mmc: vub300: Use common code in __download_offload_pseudocode()

On 27 October 2017 at 21:31, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Fri, 27 Oct 2017 21:21:40 +0200
>
> Add a jump target so that a specific string copy operation is stored
> only once at the end of this function implementation.
> Replace two calls of the function "strncpy" by goto statements.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/vub300.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
> index c1a169843f99..c898a45a84c5 100644
> --- a/drivers/mmc/host/vub300.c
> +++ b/drivers/mmc/host/vub300.c
> @@ -1244,12 +1244,8 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
>                                                 USB_RECIP_DEVICE, 0x0000, 0x0000,
>                                                 xfer_buffer, xfer_length, HZ);
>                         kfree(xfer_buffer);
> -                       if (retval < 0) {
> -                               strncpy(vub300->vub_name,
> -                                       "SDIO pseudocode download failed",
> -                                       sizeof(vub300->vub_name));
> -                               return;
> -                       }
> +                       if (retval < 0)
> +                               goto copy_error_message;
>                 } else {
>                         dev_err(&vub300->udev->dev,
>                                 "not enough memory for xfer buffer to send"
> @@ -1291,12 +1287,8 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
>                                                 USB_RECIP_DEVICE, 0x0000, 0x0000,
>                                                 xfer_buffer, xfer_length, HZ);
>                         kfree(xfer_buffer);
> -                       if (retval < 0) {
> -                               strncpy(vub300->vub_name,
> -                                       "SDIO pseudocode download failed",
> -                                       sizeof(vub300->vub_name));
> -                               return;
> -                       }
> +                       if (retval < 0)
> +                               goto copy_error_message;
>                 } else {
>                         dev_err(&vub300->udev->dev,
>                                 "not enough memory for xfer buffer to send"
> @@ -1349,6 +1341,12 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
>                         sizeof(vub300->vub_name));
>                 return;
>         }
> +
> +       return;
> +
> +copy_error_message:
> +       strncpy(vub300->vub_name, "SDIO pseudocode download failed",
> +               sizeof(vub300->vub_name));
>  }
>
>  /*
> --
> 2.14.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ