mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Joe Perches <joe@perches.com>
Cc: Alexandru Ardelean <ardeleanalex@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH] iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask()
Date: Wed, 13 Oct 2021 17:17:08 +0800	[thread overview]
Message-ID: <04c752b5-3814-34d0-82e4-9d0d46af433f@huawei.com> (raw)
In-Reply-To: <CAHp75Vdx1=q=5sNkn9o=mqnufxYiXnssmMJtXw9goFskGijc1w@mail.gmail.com>

Hi,

On 2021/10/13 4:58, Andy Shevchenko wrote:
> On Tue, Oct 12, 2021 at 8:55 PM Joe Perches <joe@perches.com> wrote:
>> On Tue, 2021-10-12 at 23:48 +0300, Andy Shevchenko wrote:
>>> On Tue, Oct 12, 2021 at 8:43 PM Joe Perches <joe@perches.com> wrote:
>>>> On Tue, 2021-10-12 at 23:30 +0300, Andy Shevchenko wrote:
>>>>> On Tue, Oct 12, 2021 at 2:37 PM Alexandru Ardelean
>>>>> <ardeleanalex@gmail.com> wrote:
>>>>>> On Tue, Oct 12, 2021 at 12:18 PM Yang Yingliang
>>>>>> <yangyingliang@huawei.com> wrote:
> ...
>
>>>>> I prefer to see
>>>>>
>>>>> - for (; unwind_idx >= 0; unwind_idx--) {
>>>>> + while (unwind_idx--)
>>>> Not the same code as unwind_idx would be decremented before entering
>>>> the code block.
>>> It's kinda cryptic what you are pointing out.
>> Not really,
> It's. It lacks the very same "additional" words to explain what you
> meant and why.
>
>>> What's needed additionally is to change
>>>
>>> - unwind_idx = iio_dev_opaque->attached_buffers_cnt - 1;
>>> + unwind_idx = i;
>> You left out that 'additional change' above from your reply.
> Yes, that's true, but it took some time to decrypt your message.
>
>>> Of course not. See above. The usual pattern is
>>>
>>>    while (i--)
>>>      do_clean_item(i);
>> Of course, but that's not what you replied.
>> I was merely pointing out that your reply included a logic change
>> converting a loop from for to while.
> I expect that developers actually think about the changes they do and
> double check what's proposed by reviewers. If they just copy'n'paste
> whatever others propose, I wouldn't take any patch from such a
> developer.
I think in alloc path is using for loop, and in error/free path also 
using for loop is better to read the code.
>

  reply	other threads:[~2021-10-13  9:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  9:25 Yang Yingliang
2021-10-12 11:36 ` Alexandru Ardelean
2021-10-12 20:30   ` Andy Shevchenko
2021-10-12 17:43     ` Joe Perches
2021-10-12 20:48       ` Andy Shevchenko
2021-10-12 17:55         ` Joe Perches
2021-10-12 20:58           ` Andy Shevchenko
2021-10-13  9:17             ` Yang Yingliang [this message]
2021-10-13  9:28               ` Andy Shevchenko
2021-10-13  9:50                 ` Andy Shevchenko
2021-10-13  2:54     ` Yang Yingliang

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=04c752b5-3814-34d0-82e4-9d0d46af433f@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=ardeleanalex@gmail.com \
    --cc=jic23@kernel.org \
    --cc=joe@perches.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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®