mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvmem: core: fix error path in nvmem_add_cells()
Date: Thu, 18 Feb 2016 06:35:46 +0100	[thread overview]
Message-ID: <87wpq2h971.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <56C45016.2010806@linaro.org> (Srinivas Kandagatla's message of "Wed, 17 Feb 2016 10:48:54 +0000")

On Wed, Feb 17 2016, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote:

>>   err:
>> -	while (--i)
>> +	while (i--)
>>   		nvmem_cell_drop(cells[i]);
> No, this will not work.
>
> 3 issues,
>
> 1> If we enter this err path from nvmem_cell_info_to_nvmem_cell()
> failures, you would be accessing already freed cells[i].
>
> 2> accessing un-allocated cells[i].
>
> 3> you would be trying to drop cells which are not in the list.
>
>
> This is what you need here to fix it correctly.
>
> while (--i >= 0)
>

Sigh. http://thread.gmane.org/gmane.linux.kernel.mm/146058/focus=2149595

TL;DR: They're equivalent.

Rasmus

  reply	other threads:[~2016-02-18  5:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 21:04 Rasmus Villemoes
2016-02-17 10:48 ` Srinivas Kandagatla
2016-02-18  5:35   ` Rasmus Villemoes [this message]
2016-02-18  9:07     ` Srinivas Kandagatla

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=87wpq2h971.fsf@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=srinivas.kandagatla@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®