diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-02-27 14:14:20 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-03-24 07:35:16 -0400 |
commit | 10cbda97e73c7d537d7174eadb2d098484f8f1da (patch) | |
tree | 9e67224345a082533d273f4926ce3281d6fe8bf1 /drivers/block/cciss.c | |
parent | a7fcd37cdcb47806fb8a9070f006ee34061defa6 (diff) |
cciss: add BUILD_BUG_ON() for catching bad CommandList_struct alignment
The hardware requires 64-bit alignment of commands, so add a build bug
check for that. The recent commit 8a3173de4ab4cdacc43675dc5c077f9a5bf17f5f
didn't change the size of the command, but other additions/changes may and
thus break badly at runtime.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4f9b6d792017..5d0e135824f9 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -3898,6 +3898,13 @@ static struct pci_driver cciss_pci_driver = { | |||
3898 | */ | 3898 | */ |
3899 | static int __init cciss_init(void) | 3899 | static int __init cciss_init(void) |
3900 | { | 3900 | { |
3901 | /* | ||
3902 | * The hardware requires that commands are aligned on a 64-bit | ||
3903 | * boundary. Given that we use pci_alloc_consistent() to allocate an | ||
3904 | * array of them, the size must be a multiple of 8 bytes. | ||
3905 | */ | ||
3906 | BUILD_BUG_ON(sizeof(CommandList_struct) % 8); | ||
3907 | |||
3901 | printk(KERN_INFO DRIVER_NAME "\n"); | 3908 | printk(KERN_INFO DRIVER_NAME "\n"); |
3902 | 3909 | ||
3903 | /* Register for our PCI devices */ | 3910 | /* Register for our PCI devices */ |