Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4163627pxf; Tue, 30 Mar 2021 00:22:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFUIuxgptF/3vkVUZDXhADjTGCVaht7kEpGg1iptPfuveZhof5iCUq/ltNndB9FO8gJ7NK X-Received: by 2002:a17:906:f9d8:: with SMTP id lj24mr32242455ejb.200.1617088968911; Tue, 30 Mar 2021 00:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617088968; cv=none; d=google.com; s=arc-20160816; b=dNBSyIOXTVTJtO1NRBfoHwmcirBoSdAweiRz1OUxkTXFYEL53RzIwGqa682fa1q/p5 DS7l5s6q1UtXEq6SbKAI1Tr0FdV4UR4exCboYGPNWu/7zzZ+7amWdxcaA4s/jBwE3zIY iFf8R8H+BOf6dbhtBy6WMCxdeXk02oQhFN7coNGfBQxq3LfKazUX1JSU5MF4fM9nsje2 fDd+9FG28xGSweYvJp0WI3Y1UXaE5BsAURKD5gGq1nNkwMINTOML6fSV8QtWCngIAXhN tP8SUEWaqmHn8LSu5COrVZURO6T7mcnUb30XcFQ6kt4iHrL32PqfAU4vPTEPOUETsFDN ki7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Spkp9IuBEpaBuiC6xE5LnYhabggmMcOiS0z5LMUpZzw=; b=lueb3AJwNOIsV/0aWH9QSTemqoaueUFOGvgxm0PVLuarfP21cc98zh35Ypxcr+VhiQ VHnTKCPK4WaknVs48jbzVnkas4qgyQgf5poESq+QpiGogl1wEyLhWl3i0Vqyvr7dJhLs j0f7Vyi1DZhyML5RUCVQHNZSUghHDv5fUZPa89dAadCBvnUFa6Z1JoW7CY+iOPclCzDy 6cCYJFJZWr8U1KyNAdzsQYbdZK52Wku8jEeZ5qBzID5iVl9Iwm0/Sc5gzKKtymu2/FjU x5Icez7vrDewM880lWLpihTJf+eYP5yqwxp1I5o6KZhxUikJsp6zVO1/XXUFV66yrTzm uiaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si14483481ejd.159.2021.03.30.00.22.26; Tue, 30 Mar 2021 00:22:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbhC3HVL (ORCPT + 99 others); Tue, 30 Mar 2021 03:21:11 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:59208 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbhC3HUl (ORCPT ); Tue, 30 Mar 2021 03:20:41 -0400 Received: by sf.home (Postfix, from userid 1000) id 4D9CE5A22063; Tue, 30 Mar 2021 08:20:32 +0100 (BST) From: Sergei Trofimovich To: "Martin K. Petersen" , Arnd Bergmann , John Paul Adrian Glaubitz , Don Brace , linux-ia64@vger.kernel.org, storagedev@microchip.com, linux-scsi , jszczype@redhat.com, Scott Benesh , Scott Teel , thenzl@redhat.com Cc: linux-kernel@vger.kernel.org, Sergei Trofimovich Subject: [PATCH v2 3/3] hpsa: add an assert to prevent from __packed reintroduction Date: Tue, 30 Mar 2021 08:19:58 +0100 Message-Id: <20210330071958.3788214-3-slyfox@gentoo.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210330071958.3788214-1-slyfox@gentoo.org> References: <20210330071958.3788214-1-slyfox@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CC: linux-ia64@vger.kernel.org CC: storagedev@microchip.com CC: linux-scsi@vger.kernel.org CC: Joe Szczypek CC: Scott Benesh CC: Scott Teel CC: Tomas Henzl CC: "Martin K. Petersen" CC: Don Brace Reported-by: John Paul Adrian Glaubitz Suggested-by: Don Brace Fixes: f749d8b7a "scsi: hpsa: Correct dev cmds outstanding for retried cmds" Signed-off-by: Sergei Trofimovich --- drivers/scsi/hpsa_cmd.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 885b1f1fb20a..ba6a3aa8d954 100644 --- a/drivers/scsi/hpsa_cmd.h +++ b/drivers/scsi/hpsa_cmd.h @@ -22,6 +22,9 @@ #include +#include /* static_assert */ +#include /* offsetof */ + /* general boundary defintions */ #define SENSEINFOBYTES 32 /* may vary between hbas */ #define SG_ENTRIES_IN_CMD 32 /* Max SG entries excluding chain blocks */ @@ -454,6 +457,15 @@ struct CommandList { atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() */ } __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 */ #define IOACCEL1_MAXSGENTRIES 24 #define IOACCEL2_MAXSGENTRIES 28 -- 2.31.1