Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933587AbbHXJ25 (ORCPT ); Mon, 24 Aug 2015 05:28:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:58120 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932625AbbHXJJ4 (ORCPT ); Mon, 24 Aug 2015 05:09:56 -0400 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Adam Radford , Christoph Hellwig , Jiri Slaby Subject: [PATCH 3.12 30/82] 3w-xxxx: fix mis-aligned struct accesses Date: Mon, 24 Aug 2015 11:08:50 +0200 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2371 Lines: 60 From: Arnd Bergmann 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 4bfaa5c4b99ddec00907e854d70453bd2aef39a0 upstream. Building an allmodconfig ARM kernel, I get multiple such warnings because of a spinlock contained in packed structure in the 3w-xxxx driver: ../drivers/scsi/3w-xxxx.c: In function 'tw_chrdev_ioctl': ../drivers/scsi/3w-xxxx.c:1001:68: warning: mis-aligned access used for structure member [-fstrict-volatile-bitfields] timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); ^ ../drivers/scsi/3w-xxxx.c:1001:68: note: when a volatile object spans multiple type-sized locations, the compiler must choose between using a single mis-aligned access to preserve the volatility, or using multiple aligned accesses to avoid runtime faults; this code may fail at runtime if the hardware does not allow this access The same bug apparently was present in 3w-sas and 3w-9xxx, but has been fixed in the past. This patch uses the same fix by moving the pragma in front of the TW_Device_Extension definition, so it only covers hardware structures. Signed-off-by: Arnd Bergmann Acked-by: Adam Radford Cc: Adam Radford Signed-off-by: Christoph Hellwig Signed-off-by: Jiri Slaby --- drivers/scsi/3w-xxxx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h index 1d31858766ce..6f65e663d393 100644 --- a/drivers/scsi/3w-xxxx.h +++ b/drivers/scsi/3w-xxxx.h @@ -387,6 +387,8 @@ typedef struct TAG_TW_Passthru unsigned char padding[12]; } TW_Passthru; +#pragma pack() + typedef struct TAG_TW_Device_Extension { u32 base_addr; unsigned long *alignment_virtual_address[TW_Q_LENGTH]; @@ -425,6 +427,4 @@ typedef struct TAG_TW_Device_Extension { wait_queue_head_t ioctl_wqueue; } TW_Device_Extension; -#pragma pack() - #endif /* _3W_XXXX_H */ -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/