Commit e01a00ff authored by Sergei Trofimovich's avatar Sergei Trofimovich Committed by Martin K. Petersen

scsi: hpsa: Add an assert to prevent __packed reintroduction

Link: https://lore.kernel.org/r/20210330071958.3788214-3-slyfox@gentoo.org
Fixes: f749d8b7 ("scsi: hpsa: Correct dev cmds outstanding for retried cmds")
CC: linux-ia64@vger.kernel.org
CC: storagedev@microchip.com
CC: linux-scsi@vger.kernel.org
CC: Joe Szczypek <jszczype@redhat.com>
CC: Scott Benesh <scott.benesh@microchip.com>
CC: Scott Teel <scott.teel@microchip.com>
CC: Tomas Henzl <thenzl@redhat.com>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: Don Brace <don.brace@microchip.com>
Reported-by: default avatarJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Suggested-by: default avatarDon Brace <don.brace@microchip.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 02ec1442
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/build_bug.h> /* static_assert */
#include <linux/stddef.h> /* offsetof */
/* general boundary defintions */ /* general boundary defintions */
#define SENSEINFOBYTES 32 /* may vary between hbas */ #define SENSEINFOBYTES 32 /* may vary between hbas */
#define SG_ENTRIES_IN_CMD 32 /* Max SG entries excluding chain blocks */ #define SG_ENTRIES_IN_CMD 32 /* Max SG entries excluding chain blocks */
...@@ -454,6 +457,15 @@ struct CommandList { ...@@ -454,6 +457,15 @@ struct CommandList {
atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() */ atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() */
} __aligned(COMMANDLIST_ALIGNMENT); } __aligned(COMMANDLIST_ALIGNMENT);
/*
* Make sure our embedded atomic variable is aligned. Otherwise we break atomic
* operations on architectures that don't support unaligned atomics like IA64.
*
* The assert guards against reintroductin against unwanted __packed to
* the struct CommandList.
*/
static_assert(offsetof(struct CommandList, refcount) % __alignof__(atomic_t) == 0);
/* Max S/G elements in I/O accelerator command */ /* Max S/G elements in I/O accelerator command */
#define IOACCEL1_MAXSGENTRIES 24 #define IOACCEL1_MAXSGENTRIES 24
#define IOACCEL2_MAXSGENTRIES 28 #define IOACCEL2_MAXSGENTRIES 28
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment