]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
megaraid: Fix unaligned warning
authorAllen Pais <allen.pais@oracle.com>
Wed, 29 Mar 2017 08:51:58 +0000 (14:21 +0530)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 6 Apr 2017 07:13:57 +0000 (00:13 -0700)
The MegaRAID userland descriptor structures do not properly align
pointers on their natural boundaries. This causes warnings to be issued
when storcli or the SNMP daemon are in use.

Quiesce the warning until the user-kernel interface has been fixed.

Orabug: 24817799

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 069af368ac74dc0130f91836b9f85f7cd5b18749)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
drivers/scsi/megaraid/megaraid_sas_base.c

index 890637fdd61e3535da093d0f9b41e4efc95eca13..99195a6312f5284550c4c1c9a5ccb4a9785c34ed 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/uio.h>
 #include <linux/slab.h>
 #include <asm/uaccess.h>
+#include <asm/unaligned.h>
 #include <linux/fs.h>
 #include <linux/compat.h>
 #include <linux/blkdev.h>
@@ -6178,7 +6179,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
                sense_ptr = (unsigned long *) ((unsigned long)ioc->frame.raw +
                                ioc->sense_off);
 
-               if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)),
+               unsigned long tmp = get_unaligned((unsigned long *) sense_ptr);
+               if (copy_to_user((void __user *)((unsigned long)tmp),
                                 sense, ioc->sense_len)) {
                        printk(KERN_ERR "megasas: Failed to copy out to user "
                                        "sense data\n");