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]
Date:   Wed, 27 May 2020 09:34:54 +0200
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Pali Rohár <pali@...nel.org>
Cc:     "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Marek Behún <marek.behun@....cz>
Subject: Re: [PATCH 1/2] mmc: core: Do not export MMC_NAME= and
 MODALIAS=mmc:block for SDIO cards

On Tue, 26 May 2020 at 17:43, Pali Rohár <pali@...nel.org> wrote:
>
> SDIO non-combo cards are not handled by mmc_block driver and do not have
> accessible CID register which is used for MMC_NAME= construction.
>
> Signed-off-by: Pali Rohár <pali@...nel.org>
> Reviewed-by: Marek Behún <marek.behun@....cz>
> ---
>  drivers/mmc/core/bus.c | 23 ++++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 74de3f2dd..103eea7cd 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -93,15 +93,20 @@ mmc_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
>                         return retval;
>         }
>
> -       retval = add_uevent_var(env, "MMC_NAME=%s", mmc_card_name(card));
> -       if (retval)
> -               return retval;
> -
> -       /*
> -        * Request the mmc_block device.  Note: that this is a direct request
> -        * for the module it carries no information as to what is inserted.
> -        */
> -       retval = add_uevent_var(env, "MODALIAS=mmc:block");
> +       if (card->type != MMC_TYPE_SDIO) {
> +               retval = add_uevent_var(env, "MMC_NAME=%s", mmc_card_name(card));
> +               if (retval)
> +                       return retval;
> +
> +               /*
> +                * Request the mmc_block device.
> +                * Note: that this is a direct request for the module it carries
> +                * no information as to what is inserted.
> +                */
> +               retval = add_uevent_var(env, "MODALIAS=mmc:block");
> +               if (retval)
> +                       return retval;
> +       }
>
>         return retval;
>  }
> --
> 2.20.1
>

Overall this change makes sense to me, but at nitpick...

Rather than adding new nestled if-sentences, I suggest converting the
function into using the "early returns" pattern instead.

For example, already in the switch loop, above the code you change, we
could just return 0 instead of setting type = NULL. Likewise, you can
check "if (card->type == MMC_TYPE_SDIO) return 0;"

Kind regards
Uffe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ