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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 14 Nov 2021 16:05:11 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     davidcomponentone@...il.com, Lars-Peter Clausen <lars@...afoo.de>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] tools: iio: use swap() to make code cleaner

On Thu, 4 Nov 2021 12:36:52 +0200
Andy Shevchenko <andy.shevchenko@...il.com> wrote:

> On Thu, Nov 4, 2021 at 12:33 PM Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
> > On Thu, Nov 4, 2021 at 8:21 AM <davidcomponentone@...il.com> wrote:  
> 
> > > Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> > > opencoding it.  
> >
> > Same as per other patches. Don't be a dump addon to the robot, think
> > about the code a little bit more.
> >  
> > >  void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt)
> > >  {
> > > -       struct iio_channel_info temp;
> > >         int x, y;
> > >
> > >         for (x = 0; x < cnt; x++)
> > >                 for (y = 0; y < (cnt - 1); y++)
> > >                         if (ci_array[y].index > ci_array[y + 1].index) {
> > > -                               temp = ci_array[y + 1];
> > > -                               ci_array[y + 1] = ci_array[y];
> > > -                               ci_array[y] = temp;
> > > +                               swap(ci_array[y + 1], ci_array[y]);
> > >                         }  
> >
> > Name of the function suggests it's a sort, we have the sort_r() API,
> > use it instead.  
> 
> Ah, it's the tools folder...
> Anyway, the first part of the comment stays valid for all your contribution.
> 

Also check this builds as it doesn't for me precisely because this is in tools and
hence should be using uapi includes only.  Maybe there is one going in for this
during the merge window but it's not in my tree yet at least.

Jonathan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ