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]
Date:   Thu, 7 Jan 2021 14:38:51 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Marc Kleine-Budde <mkl@...gutronix.de>
Cc:     netdev@...r.kernel.org, davem@...emloft.net,
        linux-can@...r.kernel.org, kernel@...gutronix.de,
        Dan Murphy <dmurphy@...com>, Sean Nyekjaer <sean@...nix.com>
Subject: Re: [net-next 15/19] can: tcan4x5x: rework SPI access

On Thu, 7 Jan 2021 22:17:15 +0100 Marc Kleine-Budde wrote:
> > +struct __packed tcan4x5x_buf_cmd { 
> > +	u8 cmd; 
> > +	__be16 addr; 
> > +	u8 len; 
> > +};   
> 
> This has to be packed, as I assume the compiler would add some space after the
> "u8 cmd" to align the __be16 naturally.

Ack, packing this one makes sense.

> > +struct __packed tcan4x5x_map_buf { 
> > +	struct tcan4x5x_buf_cmd cmd; 
> > +	u8 data[256 * sizeof(u32)]; 
> > +} ____cacheline_aligned;   
> 
> Due to the packing of the struct tcan4x5x_buf_cmd it should have a length of 4
> bytes. Without __packed, will the "u8 data" come directly after the cmd?

Yup, u8 with no alignment attribute will follow the previous
field with no holes.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ