public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: Pavel Begunkov <[email protected]>,
	Stefan Metzmacher <[email protected]>,
	Linux Kernel Mailing List <[email protected]>,
	io-uring Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Ammar Faizi <[email protected]>
Subject: [PATCH v1 2/2] io_uring: uapi: Don't use a zero-size array
Date: Wed, 16 Nov 2022 04:29:53 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Ammar Faizi <[email protected]>

Don't use a zero-size array because it doesn't allow the user to
compile an app that uses liburing with the `-pedantic-errors` flag:

  io_uring.h:611:28: error: zero size arrays are an extension [-Werror,-Wzero-length-array]

Replace the array size from 0 to 1.

  - No functional change is intended.
  - No struct/union size change.

Signed-off-by: Ammar Faizi <[email protected]>
---
 include/uapi/linux/io_uring.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index 77027cbaf786..0890784fcc9e 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -85,25 +85,25 @@ struct io_uring_sqe {
 			__u16	__pad3[1];
 		};
 	};
 	union {
 		struct {
 			__u64	addr3;
 			__u64	__pad2[1];
 		};
 		/*
 		 * If the ring is initialized with IORING_SETUP_SQE128, then
 		 * this field is used for 80 bytes of arbitrary command data
 		 */
-		__u8	cmd[0];
+		__u8	cmd[1];
 	};
 };
 
 /*
  * If sqe->file_index is set to this for opcodes that instantiate a new
  * direct descriptor (like openat/openat2/accept), then io_uring will allocate
  * an available direct descriptor instead of having the application pass one
  * in. The picked direct descriptor will be returned in cqe->res, or -ENFILE
  * if the space is full.
  */
 #define IORING_FILE_INDEX_ALLOC		(~0U)
 
@@ -599,25 +599,25 @@ struct io_uring_buf {
 struct io_uring_buf_ring {
 	union {
 		/*
 		 * To avoid spilling into more pages than we need to, the
 		 * ring tail is overlaid with the io_uring_buf->resv field.
 		 */
 		struct {
 			__u64	resv1;
 			__u32	resv2;
 			__u16	resv3;
 			__u16	tail;
 		};
-		struct io_uring_buf	bufs[0];
+		struct io_uring_buf	bufs[1];
 	};
 };
 
 /* argument for IORING_(UN)REGISTER_PBUF_RING */
 struct io_uring_buf_reg {
 	__u64	ring_addr;
 	__u32	ring_entries;
 	__u16	bgid;
 	__u16	pad;
 	__u64	resv[3];
 };
 
-- 
Ammar Faizi


  parent reply	other threads:[~2022-11-15 21:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 21:29 [PATCH v1 0/2] io_uring uapi updates Ammar Faizi
2022-11-15 21:29 ` [PATCH v1 1/2] io_uring: uapi: Don't force linux/time_types.h for userspace Ammar Faizi
2022-11-15 21:29 ` Ammar Faizi [this message]
2022-11-15 23:09   ` [PATCH v1 2/2] io_uring: uapi: Don't use a zero-size array Jens Axboe
2022-11-16 10:14   ` Pavel Begunkov
2022-11-16 10:28     ` Ammar Faizi
2022-11-15 23:14 ` (subset) [PATCH v1 0/2] io_uring uapi updates Jens Axboe
2022-11-16  6:34   ` Ammar Faizi
2022-11-16  6:49     ` Ammar Faizi
2022-11-16 13:50     ` Jens Axboe
2022-11-16 14:22       ` Stefan Metzmacher
2022-11-16 19:46         ` Jens Axboe
2022-11-16 20:03           ` Stefan Metzmacher
2022-11-16 20:31             ` Pavel Begunkov
2022-11-16 20:18           ` Stefan Metzmacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox