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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fa0b596-c812-4bc5-bdc1-beb75d7928d3@embeddedor.com>
Date: Wed, 5 Feb 2025 18:33:13 +1030
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Jiri Slaby <jirislaby@...nel.org>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] tty: tty_buffer: Avoid hundreds of
 -Wflex-array-member-not-at-end warnings



On 05/02/25 17:29, Jiri Slaby wrote:
> On 05. 02. 25, 7:49, Gustavo A. R. Silva wrote:
>> If the above changes are better for you then I'll send a new patch. :)
> 
> No, you are supposed to switch tty_buffer to tty_buffer_hdr too.

Do you mean something like the following:

  struct tty_buffer {
-       union {
-               struct tty_buffer *next;
-               struct llist_node free;
-       };
-       unsigned int used;
-       unsigned int size;
-       unsigned int commit;
-       unsigned int lookahead;         /* Lazy update on recv, can become less than "read" */
-       unsigned int read;
-       bool flags;
+       struct tty_buffer_hdr hdr;
         /* Data points here */
         u8 data[] __aligned(sizeof(unsigned long));
  };

+struct tty_buffer_hdr {
+        union {
+                struct tty_buffer *next;
+                struct llist_node free;
+        };
+        unsigned int used;
+        unsigned int size;
+        unsigned int commit;
+        unsigned int lookahead; /* Lazy update on recv, can become less than "read" */
+        unsigned int read;
+        bool flags;
+};
+


The problem with this is that then we have to modify a lot of
lines from, let's say, instance->used, instance->size, etc...
to instance->hdr.used, instance->hdr.size, and so on...

This code churn is avoided if we use the struct_group() helper.

However, I'm okay with whatever you guys prefer, just let me
know.

Thanks
-Gustavo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ