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>] [day] [month] [year] [list]
Message-ID: <4146c8ae.131.1847073f91a.Coremail.wangkailong@jari.cn>
Date:   Sun, 13 Nov 2022 18:05:59 +0800 (GMT+08:00)
From:   wangkailong@...i.cn
To:     linux-kernel@...r.kernel.org
Subject:  [PATCH] tools: fix array_size.cocci warning

Fix following coccicheck warning:

tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:299:29-30:
WARNING: Use ARRAY_SIZE
tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:327:30-31:
WARNING: Use ARRAY_SIZE
tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:367:38-39:
WARNING: Use ARRAY_SIZE
tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:372:29-30:
WARNING: Use ARRAY_SIZE

Signed-off-by: KaiLong Wang <wangkailong@...i.cn>
---
 .../ffs-aio-example/multibuff/device_app/aio_multibuff.c  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c b/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c
index aaca1f44e788..c34dd108658f 100644
--- a/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c
+++ b/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c
@@ -296,7 +296,7 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
-	for (i = 0; i < sizeof(iobuf)/sizeof(*iobuf); ++i)
+	for (i = 0; i < ARRAY_SIZE(iobuf); ++i)
 		init_bufs(&iobuf[i], BUFS_MAX, BUF_LEN);
 
 	while (1) {
@@ -324,7 +324,7 @@ int main(int argc, char *argv[])
 		 * when we're preparing new data to submit,
 		 * second buffer being transmitted
 		 */
-		for (i = 0; i < sizeof(iobuf)/sizeof(*iobuf); ++i) {
+		for (i = 0; i < ARRAY_SIZE(iobuf); ++i) {
 			if (iobuf[i].requested)
 				continue;
 			/* prepare requests */
@@ -364,12 +364,12 @@ int main(int argc, char *argv[])
 
 		/* if all req's from iocb completed */
 		if (!iobuf[actual].requested)
-			actual = (actual + 1)%(sizeof(iobuf)/sizeof(*iobuf));
+			actual = (actual + 1)%(ARRAY_SIZE(iobuf));
 	}
 
 	/* free resources */
 
-	for (i = 0; i < sizeof(iobuf)/sizeof(*iobuf); ++i)
+	for (i = 0; i < ARRAY_SIZE(iobuf); ++i)
 		delete_bufs(&iobuf[i]);
 	io_destroy(ctx);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ