From patchwork Mon Feb 1 16:59:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 374279 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1471091jah; Mon, 1 Feb 2021 09:01:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMgVNVX+dgRKaOGFiX6BQbwWkWcrezngo2xWy8LNHly1aUid67IouAnxD61ea7ocYpqmS7 X-Received: by 2002:adf:f749:: with SMTP id z9mr18767233wrp.327.1612198898058; Mon, 01 Feb 2021 09:01:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612198898; cv=none; d=google.com; s=arc-20160816; b=GAWQqastLc1mmSTLwP/KDnyH4ZX78Leb0KGeNciDu4NZHqNr3pk8p7CaLlbhpNHLrh YhhcyUzjtnUWn5idgKxz61hv2jZ2zXBW7j4BC4kqSkkPVr86TU+G1CM06DxPSvHWKZCf y1Ln0ykFHoby6v6qi2pIOSyTNlUnOoypfDW0uBgLQfbLyPOYqxe0SONK9cR+KS8haUH+ yF5s0k8KmR+HNbl4w1NKjy9+zdVBbP6NoZvFMl9oyO5RgwYtt5WTDa96wnSyNC84sQsK dqTgJko7NdR+jgNeDDLeuVXh6eYfM+KIfAyUZ/njUOrL1h8oj5F9LgrNQGz82Vffk0jb PhwQ== 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=UOt/62kvJxQWQx9VRlP5IoMfW3d9qZBBRIOF6yR0SADh8wylPiBPHtHyb7DSzQsGjT Z4gzETJR6uElMRSWhEBdtEcKSj8A4Nzap7nCJN2nR2cx3DyuT8qhY7D8j+pXSfFSKCCO fSLoZTpJHKjQmr7QHBpijcYNUYY0UM9NFZFMRf9rCmiRmxwcszkOByqA/J4YgF9R7O3y aelp5yerMSQWeYqpehVOqQD0dEP1xcBdLWR4y695HqYGTftzLdvEncmV5B8MJPBZLiA3 leE10TrLEYtKeD9QiAz+VLK7+Fw3EPv/8yeYeAYmmRjoEdA8eHEVLl56Cx2BnN80rV6Z xJ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BDKyXwwl; 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 q3si11328591edn.37.2021.02.01.09.01.37 for ; Mon, 01 Feb 2021 09:01:38 -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=BDKyXwwl; 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 S230298AbhBARBE (ORCPT ); Mon, 1 Feb 2021 12:01:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:39346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbhBARBC (ORCPT ); Mon, 1 Feb 2021 12:01:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C9E7864EA9; Mon, 1 Feb 2021 17:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612198821; bh=CzTEpM9u8CI5p3juLfoehGkHvp3K66pt2EkozHWzGDg=; h=From:To:Cc:Subject:Date:From; b=BDKyXwwlbzYpaj8bPa8R9sERCroTAZz5BTHncFxHx2ICsGc3qyte09xEUwayWINCl p0noJjApDYJuiD9wlP5znE59qgt8fJu/1zNTfWepRSaKT1/ZKM904JyVHUEANoSDUB KwwpQqbBpmo9+rksKSDazzqpBBlZPzWIFDrVizrAspmtC/6w77Ksp3BDIItMDh/5+8 59qacGyiE63CBaaRL80+CDdAnKte9cOAWnocFsgqnkpE2A866O3awPgwHwGn+21PkY iOJqw/qR+GmmSErJZxbDKlYakFhHBGQMsITb2bRJJl9nUgD9nqfA9rILzvG79IBwsW IBnnjeF8PdQOA== 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: Mon, 1 Feb 2021 17:59:54 +0100 Message-Id: <20210201170013.727112-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 Reviewed-by: Lee Jones 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