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] [day] [month] [year] [list]
Date:   Tue, 2 Feb 2021 08:17:51 +0000
From:   Lee Jones <lee.jones@...aro.org>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Arnd Bergmann <arnd@...db.de>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Satish Kharat <satishkh@...co.com>,
        Lee Duncan <lduncan@...e.com>, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: pmcraid: fix 'ioarcb' alignment warning

On Mon, 01 Feb 2021, Arnd Bergmann wrote:

> From: Arnd Bergmann <arnd@...db.de>
> 
> Building with 'make W=1' enables -Wpacked-not-aligned, and this
> warns about pmcraid because of incompatible alignment constraints for
> pmcraid_passthrough_ioctl_buffer:
> 
> drivers/scsi/pmcraid.h:1044:1: warning: alignment 1 of 'struct pmcraid_passthrough_ioctl_buffer' is less than 32 [-Wpacked-not-aligned]
>  1044 | } __attribute__ ((packed));
>       | ^
> drivers/scsi/pmcraid.h:1041:24: warning: 'ioarcb' offset 16 in 'struct pmcraid_passthrough_ioctl_buffer' isn't aligned to 32 [-Wpacked-not-aligned]
>  1041 |  struct pmcraid_ioarcb ioarcb;
> 
> The inner structure is documented as having 32 byte alignment here,
> but is starts at a 16 byte offset in the outer structure, so it's never
> actually aligned, as the outer structure is also marked 'packed'.
> 
> Lee Jones point this out as one of the last files that need to be changed
> before the warning can be enabled by default.
> 
> Change the annotations in a way that avoids the warning but leaves the
> layout unchanged, by removing the packing on the inner structure and
> adding it to the outer one. The one-byte request_buffer[] array should
> have been a flexible array member here, which is how I change it to
> avoid extra padding from the alignment attribute.

Looks good to me.

Reviewed-by: Lee Jones <lee.jones@...aro.org>

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ