[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YMJSXCRGzJz+Sfqb@kroah.com>
Date: Thu, 10 Jun 2021 19:56:44 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Cc: valentina.manea.m@...il.com, shuah@...nel.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usbip: tools: usbipd: use ARRAY_SIZE for sockfdlist
On Wed, Jun 09, 2021 at 05:51:56PM +0800, Jiapeng Chong wrote:
> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an
> element.
>
> Clean up the following coccicheck warning:
>
> ./tools/usb/usbip/src/usbipd.c:536:19-20: WARNING: Use ARRAY_SIZE.
>
> Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
> ---
> tools/usb/usbip/src/usbipd.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
> index 48398a7..4826d13 100644
> --- a/tools/usb/usbip/src/usbipd.c
> +++ b/tools/usb/usbip/src/usbipd.c
> @@ -532,8 +532,7 @@ static int do_standalone_mode(int daemonize, int ipv4, int ipv6)
> usbip_driver_close(driver);
> return -1;
> }
> - nsockfd = listen_all_addrinfo(ai_head, sockfdlist,
> - sizeof(sockfdlist) / sizeof(*sockfdlist));
> + nsockfd = listen_all_addrinfo(ai_head, sockfdlist, ARRAY_SIZE(sockfdlist));
Always test-build your patches before sending them out, otherwise you
just get grumpy maintainers complaining when you break the build :(
Your "robot" needs some serious work here.
greg k-h
Powered by blists - more mailing lists