* [PATCH] usbip: tools: usbipd: use ARRAY_SIZE for sockfdlist
@ 2021-06-09 9:51 Jiapeng Chong
2021-06-09 15:23 ` Shuah Khan
2021-06-10 17:56 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Jiapeng Chong @ 2021-06-09 9:51 UTC (permalink / raw)
To: valentina.manea.m; +Cc: shuah, linux-usb, linux-kernel, Jiapeng Chong
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@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.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));
freeaddrinfo(ai_head);
if (nsockfd <= 0) {
err("failed to open a listening socket");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usbip: tools: usbipd: use ARRAY_SIZE for sockfdlist
2021-06-09 9:51 [PATCH] usbip: tools: usbipd: use ARRAY_SIZE for sockfdlist Jiapeng Chong
@ 2021-06-09 15:23 ` Shuah Khan
2021-06-10 17:56 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2021-06-09 15:23 UTC (permalink / raw)
To: Jiapeng Chong, valentina.manea.m
Cc: shuah, linux-usb, linux-kernel, Shuah Khan
On 6/9/21 3:51 AM, 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@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.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));
> freeaddrinfo(ai_head);
> if (nsockfd <= 0) {
> err("failed to open a listening socket");
>
The change looks good. Does this change compile for you?
Doesn't for me?
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usbip: tools: usbipd: use ARRAY_SIZE for sockfdlist
2021-06-09 9:51 [PATCH] usbip: tools: usbipd: use ARRAY_SIZE for sockfdlist Jiapeng Chong
2021-06-09 15:23 ` Shuah Khan
@ 2021-06-10 17:56 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-06-10 17:56 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: valentina.manea.m, shuah, linux-usb, linux-kernel
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@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-10 17:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 9:51 [PATCH] usbip: tools: usbipd: use ARRAY_SIZE for sockfdlist Jiapeng Chong
2021-06-09 15:23 ` Shuah Khan
2021-06-10 17:56 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.