From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
Mike Frysinger <vapier@gentoo.org>,
kernel-janitors@vger.kernel.org, Gabor Juhos <juhosg@openwrt.org>,
linux-mtd@lists.infradead.org,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [patch 2/2] mtd/m25p80: fix test for end of loop
Date: Thu, 12 Aug 2010 11:17:05 +0000 [thread overview]
Message-ID: <20100812111705.GA9966@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20100812075827.GO645@bicker>
On Thu, Aug 12, 2010 at 09:58:27AM +0200, Dan Carpenter wrote:
> "plat_id" is always non-NULL here. There is a zero element on the end
> of the m25p_ids[] array and if we hit the end of the loop then plat_id
> points to that.
>
> This would lead to a NULL pointer dereference later on in the function.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Thanks,
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 83c9086..6f512b5 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -793,7 +793,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
> break;
> }
>
> - if (plat_id)
> + if (i < ARRAY_SIZE(m25p_ids) - 1)
> id = plat_id;
> else
> dev_warn(&spi->dev, "unrecognized id %s\n", data->type);
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
Mike Frysinger <vapier@gentoo.org>,
kernel-janitors@vger.kernel.org, Gabor Juhos <juhosg@openwrt.org>,
linux-mtd@lists.infradead.org,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [patch 2/2] mtd/m25p80: fix test for end of loop
Date: Thu, 12 Aug 2010 15:17:05 +0400 [thread overview]
Message-ID: <20100812111705.GA9966@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20100812075827.GO645@bicker>
On Thu, Aug 12, 2010 at 09:58:27AM +0200, Dan Carpenter wrote:
> "plat_id" is always non-NULL here. There is a zero element on the end
> of the m25p_ids[] array and if we hit the end of the loop then plat_id
> points to that.
>
> This would lead to a NULL pointer dereference later on in the function.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Thanks,
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 83c9086..6f512b5 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -793,7 +793,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
> break;
> }
>
> - if (plat_id)
> + if (i < ARRAY_SIZE(m25p_ids) - 1)
> id = plat_id;
> else
> dev_warn(&spi->dev, "unrecognized id %s\n", data->type);
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2010-08-12 11:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-12 7:58 [patch 2/2] mtd/m25p80: fix test for end of loop Dan Carpenter
2010-08-12 7:58 ` Dan Carpenter
2010-08-12 11:17 ` Anton Vorontsov [this message]
2010-08-12 11:17 ` Anton Vorontsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100812111705.GA9966@oksana.dev.rtsoft.ru \
--to=cbouatmailru@gmail.com \
--cc=Artem.Bityutskiy@nokia.com \
--cc=dwmw2@infradead.org \
--cc=error27@gmail.com \
--cc=juhosg@openwrt.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.