From patchwork Thu Feb 4 16:30:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 376296 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1441876jah; Thu, 4 Feb 2021 08:40:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxc53n+Uyf3YVrD32yhimyY089GLKxu0YEcBJRjOrEG16s9jX7G7fk5iaVEk9vmrd0u7l03 X-Received: by 2002:a17:906:3105:: with SMTP id 5mr5466836ejx.168.1612456814869; Thu, 04 Feb 2021 08:40:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612456814; cv=none; d=google.com; s=arc-20160816; b=CvAJgfalWnMu98f2PZsZEvB1J78VDVgy4lglKYmUYDEnjL5MOP33QUnCgW9jDKSXGi SJ4Bp/eCXWzmPZmSzrfCbOX8N9JcxNqZWeSdXZUYveEwt6PObD22QncLNt9nyARz3PR/ ABKYYVN7FxZJBdkvQBjiUJ5SMZiI5B0Q9hF5XjpNAf2UiNZWUqu1v5Hif8yuOSmtl8oJ HDo0A97Wtb3xo4h4ZsMFHT2goxO2+aSqfpqRKpAAhKolzos2Y2nTdi0GJayHBvpwjKuc 7Ot5r7IrAW22WEGA3RDhuRLqKdLTIVlzWk2Csafc0Z6OP1+2AfZWBRejkRxENugCylh2 J2mA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=q+z4qhnAtInw9YAHbWVTMmjZY7QKD2ElFcmVv0IvMzk=; b=o6FYGw+J+TL2lkTjf1882o8D1MH/hf33Owl3EQZkWDNapUwzL4ZUfQmCCJ5CC99s2+ o5Zy3NYUFjAeKcKgFbonxLZg9aefFScvkVzhC+E8bfrdGVy8nCzac/Zn1T5QtdvExtOy rH0NBwSBCxIc+2Gs0AovP4Pdgxv+wfkLiptZmSDg3J5Dt/lZwnCQPuoQDhsnSO/XKqae Tw+jk1bOI/RaZTEMJgDWLENUf70Ed8vTM/YFhkNGj2HMCqfMG9MALp72zf5MH53CWw4+ h5k9Tnox5v+DwLTPsRR1mVKTxEuImPgm9nIlj6VWN42qmE+4DQwKaV7nybGzjsyzH2Cg 0B3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SGPgNrPK; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si4204507edy.113.2021.02.04.08.40.14 for ; Thu, 04 Feb 2021 08:40:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SGPgNrPK; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237484AbhBDQjO (ORCPT ); Thu, 4 Feb 2021 11:39:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:46770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238087AbhBDQbF (ORCPT ); Thu, 4 Feb 2021 11:31:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56A6E64F42; Thu, 4 Feb 2021 16:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612456225; bh=CzTEpM9u8CI5p3juLfoehGkHvp3K66pt2EkozHWzGDg=; h=From:To:Cc:Subject:Date:From; b=SGPgNrPK6w9SYhailX+Myofm8zqDZypXNuD/ZTl8DQ60fMj9rLjJ1uHrtFYl0wAiD DcamnU0Y2XEhwTAKkT/fAzmU3y+l8/peZ1wMY8pLk2bz0l/T1eA7dqm4DHbteJZK6F 3DDpqluvT7t4E0XK3nXLaIH1X0SKyKNLBJYo+DsywNdPSZfa2HV7FPmOZAXa+Ifhkd j9RKC+pqVollzFmEOUXFctg4+jlqcDEC88l2yq3KLUzmkyc8RIxhj3xw32rF32uKuN ErfmDH4yktP1UnzzwSu6/Di+zrW/k3bYDOjC4SxpGHa/yTxWDx4PAlJd2PI0AwCXxs DaV2OnBBggOMw== From: Arnd Bergmann To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Lee Jones , "Gustavo A. R. Silva" , Satish Kharat , Lee Duncan , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: pmcraid: fix 'ioarcb' alignment warning Date: Thu, 4 Feb 2021 17:30:14 +0100 Message-Id: <20210204163020.3286210-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arnd Bergmann Building with 'make W=1' enables -Wpacked-not-aligned, and this warns about pmcraid because of incompatible alignment constraints for pmcraid_passthrough_ioctl_buffer: drivers/scsi/pmcraid.h:1044:1: warning: alignment 1 of 'struct pmcraid_passthrough_ioctl_buffer' is less than 32 [-Wpacked-not-aligned] 1044 | } __attribute__ ((packed)); | ^ drivers/scsi/pmcraid.h:1041:24: warning: 'ioarcb' offset 16 in 'struct pmcraid_passthrough_ioctl_buffer' isn't aligned to 32 [-Wpacked-not-aligned] 1041 | struct pmcraid_ioarcb ioarcb; The inner structure is documented as having 32 byte alignment here, but is starts at a 16 byte offset in the outer structure, so it's never actually aligned, as the outer structure is also marked 'packed'. Lee Jones point this out as one of the last files that need to be changed before the warning can be enabled by default. Change the annotations in a way that avoids the warning but leaves the layout unchanged, by removing the packing on the inner structure and adding it to the outer one. The one-byte request_buffer[] array should have been a flexible array member here, which is how I change it to avoid extra padding from the alignment attribute. Cc: Lee Jones Signed-off-by: Arnd Bergmann --- drivers/scsi/pmcraid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.29.2 diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h index 15c962108075..6d36debde18e 100644 --- a/drivers/scsi/pmcraid.h +++ b/drivers/scsi/pmcraid.h @@ -244,7 +244,7 @@ struct pmcraid_ioarcb { __u8 hrrq_id; __u8 cdb[PMCRAID_MAX_CDB_LEN]; struct pmcraid_ioarcb_add_data add_data; -} __attribute__((packed, aligned(PMCRAID_IOARCB_ALIGNMENT))); +}; /* well known resource handle values */ #define PMCRAID_IOA_RES_HANDLE 0xffffffff @@ -1040,8 +1040,8 @@ struct pmcraid_passthrough_ioctl_buffer { struct pmcraid_ioctl_header ioctl_header; struct pmcraid_ioarcb ioarcb; struct pmcraid_ioasa ioasa; - u8 request_buffer[1]; -} __attribute__ ((packed)); + u8 request_buffer[]; +} __attribute__ ((packed, aligned(PMCRAID_IOARCB_ALIGNMENT))); /* * keys to differentiate between driver handled IOCTLs and passthrough