Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1266698
| From | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] mtd: phram: error handling |
| Date | 2015-11-10 19:30 +0100 |
| Message-ID | <qtlQ5-9M-9@gated-at.bofh.it> (permalink) |
| References | <qsFHc-5tw-7@gated-at.bofh.it> <qsO7M-2Ku-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Nov 09, 2015 at 11:53:18AM +0530, Saurabh Sengar wrote:
> registering the device with NULL pointer can lead to crash,
> hence fixing it
>
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> > Andy Shevchenko wrote:
> > Hmm… Why not just checking it before an register attempt? I think user
> > is in right to know as many problems as they have at one shot, with
> > your patch if there are two problems the user has to try twice.
> Yes, taken your feedback, fixing it here in v2 as you recommended
>
> drivers/mtd/devices/phram.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
> index 8b66e52..46b7a8a 100644
> --- a/drivers/mtd/devices/phram.c
> +++ b/drivers/mtd/devices/phram.c
> @@ -257,6 +257,9 @@ static int phram_setup(const char *val)
> parse_err("illegal device length\n");
> }
>
> + if(!name)
> + return -EINVAL;
I'm not sure how this is supposed to do anything... just because you
kfree()'d the name doesn't mean it is NULL. In fact, I don't see how
you'd get name==NULL at all. It is assigned once (in parse_name()), and
if it's NULL, we already exit early. And 'name' is never modified after
that point.
So... did you test your patch?
(*looks at the existing code a bit more*)
Hey, I think your patch is all futile anyway. Did you notice that
there's a "return" statement embedded in the parse_err() macro? So there
was no bug in the first place, and I think you're just blowing smoke.
Please verify that you're actually fixing bugs, and please test your
patches. Otherwise, you're wasting my time.
Brian
> +
> ret = register_device(name, start, len);
> if (!ret)
> pr_info("%s device: %#llx at %#llx\n", name, len, start);
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-08 09:50 +0100
Re: [PATCH] mtd: phram: error handling Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-08 22:30 +0100
[PATCH v2] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-09 07:30 +0100
Re: [PATCH v2] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 19:30 +0100
[PATCH] mtd: phram: error handling Joe Perches <joe@perches.com> - 2015-11-10 19:40 +0100
Re: [PATCH] mtd: phram: error handling Joe Perches <joe@perches.com> - 2015-11-10 19:50 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 20:10 +0100
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-10 20:30 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 20:50 +0100
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-11 09:30 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-11 20:50 +0100
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-12 07:30 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 19:50 +0100
csiph-web