[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFo2cZOqyCqBaZJzReaWfMenn6zgHcpCpf+XfegwqwNKxQ@mail.gmail.com>
Date: Tue, 16 Apr 2019 09:48:51 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Pavel Machek <pavel@....cz>
Cc: kernel list <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...l.org>,
Trivial patch monkey <trivial@...nel.org>
Subject: Re: [PATCH] Fix warning and undefined behavior in mmc voltage handling
On Fri, 12 Apr 2019 at 11:34, Pavel Machek <pavel@....cz> wrote:
>
> !voltage_ranges is tested for too late, allowing warning and undefined
> behavior. Fix that.
>
> Signed-off-by: Pavel Machek <pavel@....cz>
Pavel, thanks for your patch.
Would you mind re-posting to linux-mmc so I can get it into the
patchtracker. Please also change the prefix of the header to "mmc:
core:".
Otherwise this looks good to me.
Kind regards
Uffe
>
> ---
>
> Plus I guess author should add parenthesis in the expression. a / b /
> c is _not_ common idiom.
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 3a4402a..b3fa9c9 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -363,11 +363,11 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
> int num_ranges, i;
>
> voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
> - num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
> if (!voltage_ranges) {
> pr_debug("%pOF: voltage-ranges unspecified\n", np);
> return 0;
> }
> + num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
> if (!num_ranges) {
> pr_err("%pOF: voltage-ranges empty\n", np);
> return -EINVAL;
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Powered by blists - more mailing lists