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: <8fa64c82-d5f8-4045-8ebf-5b938df8cc7c@kernel.org>
Date: Thu, 7 Aug 2025 09:37:07 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Arnd Bergmann <arnd@...db.de>,
 Abinash Singh <abinashsinghlalotra@...il.com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 Sunil V L <sunilvl@...tanamicro.com>,
 Uwe Kleine-König <u.kleine-koenig@...libre.com>,
 linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org
Subject: Re: [RFC PATCH 1/2] tty: serial/8250: Fix build warning in
 serial8250_probe_acpi()

On 07. 08. 25, 8:43, Jiri Slaby wrote:
> On 07. 08. 25, 7:25, Jiri Slaby wrote:
>> On 06. 08. 25, 9:01, Arnd Bergmann wrote:
>>> Note how serial8250_register_8250_port() ands up just copying
>>> individual members of the passed uart_8250_port structure into
>>> the global array of the same type, so one way of addressing
>>> this would be to use a structure for initialization that only
>>> contains a subset of the uart_8250_port members and can still
>>> be allocated on the stack, or possibly be constant.
>>
>> Yes:
>> https://lore.kernel.org/all/ 
>> f84c2ee3-77b4-41c4-8517-26dfb44a2276@...nel.org/
> 
> As a PoC, these members from uart_8250_port are really used in 
> serial8250_register_8250_port():
> struct uart_8250_port2 {
>          long unsigned int          iobase;               /*     0     8 */
>          resource_size_t            mapbase;              /*     8     8 */
>          unsigned char *            membase;              /*    16     8 */
>          long unsigned int          irqflags;             /*    24     8 */
>          upf_t                      flags;                /*    32     8 */
>          enum uart_iotype           iotype;               /*    40     4 */
>          unsigned int               tx_loadsz;            /*    44     4 */
>          unsigned int               type;                 /*    48     4 */
>          u32                        overrun_backoff_time_ms; /*    52  4 */
>          u32                        capabilities;         /*    56     4 */
>          unsigned int               line;                 /*    60     4 */
>          /* --- cacheline 1 boundary (64 bytes) --- */
>          unsigned int               uartclk;              /*    64     4 */
>          unsigned int               ctrl_id;              /*    68     4 */
>          unsigned int               port_id;              /*    72     4 */
>          unsigned int               irq;                  /*    76     4 */
>          unsigned int               fifosize;             /*    80     4 */
>          u16                        bugs;                 /*    84     2 */
>          u16                        lsr_save_mask;        /*    86     2 */
>          unsigned char              regshift;             /*    88     1 */
>          unsigned char              hub6;                 /*    89     1 */
> 
>          /* XXX 6 bytes hole, try to pack */
> 
>          resource_size_t            mapsize;              /*    96     8 */
>          struct serial_rs485        rs485;                /*   104    32 */
>          /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
>          struct serial_rs485        rs485_supported;      /*   136    32 */
>          void *                     private_data;         /*   168     8 */
>          struct uart_8250_dma *     dma;                  /*   176     8 */

And if in the above link mentioned conversion to ops [1] is finished, we 
would replace all the below by a single pointer to a const ops. The 
struct would be then 176+8.

[1] the two "ops" commits at 
https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/log/?h=devel

>          void                       (*rs485_start_tx)(struct 
> uart_8250_port *, bool); /*   184     8 */
>          /* --- cacheline 3 boundary (192 bytes) --- */
>          void                       (*rs485_stop_tx)(struct 
> uart_8250_port *, bool); /*   192     8 */
>          void                       (*throttle)(struct uart_port *); /* 
>   200     8 */
>          void                       (*unthrottle)(struct uart_port *); / 
> *   208     8 */
>          u32                        (*serial_in)(struct uart_port *, 
> unsigned int); /*   216     8 */
>          void                       (*serial_out)(struct uart_port *, 
> unsigned int, u32); /*   224     8 */
>          void                       (*set_termios)(struct uart_port *, 
> struct ktermios *, const struct ktermios  *); /*   232     8 */
>          void                       (*set_ldisc)(struct uart_port *, 
> struct ktermios *); /*   240     8 */
>          unsigned int               (*get_mctrl)(struct uart_port *); /* 
>    248     8 */
>          /* --- cacheline 4 boundary (256 bytes) --- */
>          void                       (*set_mctrl)(struct uart_port *, 
> unsigned int); /*   256     8 */
>          unsigned int               (*get_divisor)(struct uart_port *, 
> unsigned int, unsigned int *); /*   264     8 */
>          void                       (*set_divisor)(struct uart_port *, 
> unsigned int, unsigned int, unsigned int); /*   272     8 */
>          int                        (*startup)(struct uart_port *); /* 
> 280     8 */
>          void                       (*shutdown)(struct uart_port *); /* 
>   288     8 */
>          int                        (*handle_irq)(struct uart_port *); / 
> *   296     8 */
>          void                       (*pm)(struct uart_port *, unsigned 
> int, unsigned int); /*   304     8 */
>          void                       (*handle_break)(struct uart_port 
> *); /*   312     8 */
>          /* --- cacheline 5 boundary (320 bytes) --- */
>          int                        (*rs485_config)(struct uart_port *, 
> struct ktermios *, struct serial_rs485 *); /*   320     8 */
>          struct device *            dev;                  /*   328     8 */
>          u32                        (*dl_read)(struct uart_8250_port 
> *); /*   336     8 */
>          void                       (*dl_write)(struct uart_8250_port *, 
> u32); /*   344     8 */
> 
>          /* size: 352, cachelines: 6, members: 46 */
>          /* sum members: 346, holes: 1, sum holes: 6 */
>          /* last cacheline: 32 bytes */
> };
> 
> 

-- 
js
suse labs


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ