public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Arnd Bergmann <arnd@arndb.de>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Satish Kharat <satishkh@cisco.com>, Lee Duncan <lduncan@suse.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: pmcraid: fix 'ioarcb' alignment warning
Date: Tue, 2 Feb 2021 08:17:51 +0000	[thread overview]
Message-ID: <20210202081751.GZ4774@dell> (raw)
In-Reply-To: <20210201170013.727112-1-arnd@kernel.org>

On Mon, 01 Feb 2021, Arnd Bergmann wrote:

> From: Arnd Bergmann <arnd@arndb.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@linaro.org>

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

  reply	other threads:[~2021-02-02  8:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 16:59 [PATCH] scsi: pmcraid: fix 'ioarcb' alignment warning Arnd Bergmann
2021-02-02  8:17 ` Lee Jones [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-04 16:30 Arnd Bergmann
2021-02-09  2:23 ` Martin K. Petersen

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 \
    --in-reply-to=20210202081751.GZ4774@dell \
    --to=lee.jones@linaro.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=gustavo@embeddedor.com \
    --cc=jejb@linux.ibm.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=satishkh@cisco.com \
    /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