lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 13 Oct 2021 12:28:24 +0300 From: Andy Shevchenko <andy.shevchenko@...il.com> To: Yang Yingliang <yangyingliang@...wei.com> Cc: Joe Perches <joe@...ches.com>, Alexandru Ardelean <ardeleanalex@...il.com>, LKML <linux-kernel@...r.kernel.org>, linux-iio <linux-iio@...r.kernel.org>, Lars-Peter Clausen <lars@...afoo.de>, Jonathan Cameron <jic23@...nel.org> Subject: Re: [PATCH] iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask() On Wed, Oct 13, 2021 at 12:17 PM Yang Yingliang <yangyingliang@...wei.com> wrote: > On 2021/10/13 4:58, Andy Shevchenko wrote: > > On Tue, Oct 12, 2021 at 8:55 PM Joe Perches <joe@...ches.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@...ches.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@...il.com> wrote: > >>>>>> On Tue, Oct 12, 2021 at 12:18 PM Yang Yingliang > >>>>>> <yangyingliang@...wei.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. I don't think so. while(idx--) is kinda idiom which is really easy to read. I could send a v2 on your behalf. -- With Best Regards, Andy Shevchenko
Powered by blists - more mailing lists