[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ypo/P1LpcGEGDT1/@smile.fi.intel.com>
Date: Fri, 3 Jun 2022 20:05:03 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Joe Perches <joe@...ches.com>
Cc: linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Kalle Valo <kvalo@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v1 1/2] wireless: ray_cs: Utilize strnlen() in
parse_addr()
On Fri, Jun 03, 2022 at 09:50:55AM -0700, Joe Perches wrote:
> On Fri, 2022-06-03 at 19:44 +0300, Andy Shevchenko wrote:
> > Instead of doing simple operations and using an additional variable on stack,
> > utilize strnlen() and reuse len variable.
> []
> > diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
> []
> > + while (len > 0) {
> > + if ((k = hex_to_bin(in_str[len--])) != -1)
> > out[i] = k;
> > else
> > return 0;
>
> could be reversed and unindented
>
> >
> > - if (j == 0)
> > + if (len == 0)
> > break;
> > - if ((k = hex_to_bin(in_str[j--])) != -1)
> > + if ((k = hex_to_bin(in_str[len--])) != -1)
> > out[i] += k << 4;
> > else
> > return 0;
>
> and here
It might be done as a follow up. Thanks!
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists