Message ID | 20230703114851.1194510-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp464038vqx; Mon, 3 Jul 2023 05:01:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHTnZCI8toeOUlmSMmqMbHYhZ6ha6lRnirzPB1VAZutj6Ago1EvweNWOjEdwjnGtcG9rT0b X-Received: by 2002:a17:902:ea0a:b0:1b8:35fa:cdcc with SMTP id s10-20020a170902ea0a00b001b835facdccmr10803153plg.5.1688385673404; Mon, 03 Jul 2023 05:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688385673; cv=none; d=google.com; s=arc-20160816; b=lOLzdfQ5URDUnyDA5fiCPfrXJM71+6vxIRGs/16RdMZ4fbRIvJoQ++opcXXkN1k+E7 GR4L+in2LVrtV1mLwKe9nVTGjKQc8ZbiPKgqFnNpFGsRPi3v43XHGGA6lZFoLxTsCBlR CwOssYJkRm13mK0ECXz9lYlXQVnObWjbjfTAP27IQsnE0rPseLxBAgnmWrphIIdl+//M Rp+9THRN7QS8JDgDPK14im1ZVLZ4fO4vXq+ZIUKQF8b8inWwOZgb2Ad44S01xhA+yWxA r6dC8m15ADV1jP8/k0+qRlt4EnF+SB5xJSI0oL/ldoMK+pvNPjyN5v1nTK3Ka24twp0c GbTw== 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=AaqhTMf83owBBFam8QBB/NWzzWVanICsEmwTFxPAc6Q=; fh=m35lDzHlwGSzWD5Yi+NEbF2mdpfskw+OGVG3COIHFdI=; b=Pp7MrMtamHxL+yTi99j9EEyX18KawodagIWKREIaelmP7utUZwbIVuixIZyMk+BH2M TLTRzcD4E69Y++l+IUQAOqJFLIPnralN6UbBiXy6z+xL9j/RTuykQ8By5vZU0C1zq8Cz ZqRPIxU6shAMnb5efnxpV8N5YMJDG7MgePug3RtdHJYV7vxanNUePgteeBv58PNff9R8 5anM/SLP2X44OYXiYzH8d0dXNxnfo8q62TFxxGgAo+8LzM+QCUv11poUYszIi0+sV09S 9eECKnHHpp2F3d/6TNOUy/UYyaa39bLgjT4ahnGG7sDxVyFN3p/RGfACRIfxfAP3nFvU x+gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WbI6uLAp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a170903244800b001b891e63329si2883786pls.421.2023.07.03.05.00.44; Mon, 03 Jul 2023 05:01:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WbI6uLAp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S231367AbjGCLtA (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Mon, 3 Jul 2023 07:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbjGCLs7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Jul 2023 07:48:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ADC1E8; Mon, 3 Jul 2023 04:48:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2247460F03; Mon, 3 Jul 2023 11:48:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BD04C433C7; Mon, 3 Jul 2023 11:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688384936; bh=94E1xNeUaIhmByKLDdNMrVR1xm0w+a+Mcuf+Blcmadc=; h=From:To:Cc:Subject:Date:From; b=WbI6uLApPdI5dT9UVGlzwVzAKqDwBkfbJje5v74MQrn25edivWB2mBcmuQhny5Btt f0SF+P1kYRMTnOyNdM0bSQkbYxL6R+gxLAdRD2sMaYYI/2q47d3BmAIIc7InTkbm+z PzZZ5TyPUMkwOShlfNTsksnsVZg5JfRgZo2+RmlA1uUhFdCxyjx6j7pJZiQ5DLkqWi YGr0jG96eySZaUmlVuxVOyK+3CFFeknltvP0Dwdy8b6t5pbNogHWoMFaMrWeQMm5W2 pDjSKb2MoXUxAc2LOu9dMKvHzFEXFr7tCimrdivOf3r524jlPSS9z7IbKV0SM+bOn3 CemdKD6+pQKYg== From: Arnd Bergmann <arnd@kernel.org> To: Adaptec OEM Raid Solutions <aacraid@microsemi.com>, "James E.J. Bottomley" <jejb@linux.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de>, Sagar Biradar <sagar.biradar@microchip.com>, John Garry <john.g.garry@oracle.com>, Gilbert Wu <gilbert.wu@microchip.com>, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: aacraid: avoid -Warray-bounds warning Date: Mon, 3 Jul 2023 13:48:46 +0200 Message-Id: <20230703114851.1194510-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770400696180452542?= X-GMAIL-MSGID: =?utf-8?q?1770400696180452542?= |
Series |
scsi: aacraid: avoid -Warray-bounds warning
|
|
Commit Message
Arnd Bergmann
July 3, 2023, 11:48 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The one-element array in aac_aifcmd is actually meant as a flexible array, and causes an overflow warning that can be avoided using the normal flex arrays: drivers/scsi/aacraid/commsup.c:1166:17: error: array index 1 is past the end of the array (that has type 'u8[1]' (aka 'unsigned char[1]'), cast to '__le32 *' (aka 'unsigned int *')) [-Werror,-Warray-bounds] (((__le32 *)aifcmd->data)[1] == cpu_to_le32(3)); ^ ~ Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/scsi/aacraid/aacraid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Arnd, > The one-element array in aac_aifcmd is actually meant as a flexible > array, and causes an overflow warning that can be avoided using the > normal flex arrays: Applied to 6.5/scsi-staging, thanks!
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 7c6efde75da66..73b6ac0c01f54 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2618,7 +2618,7 @@ struct aac_hba_info { struct aac_aifcmd { __le32 command; /* Tell host what type of notify this is */ __le32 seqnum; /* To allow ordering of reports (if necessary) */ - u8 data[1]; /* Undefined length (from kernel viewpoint) */ + u8 data[]; /* Undefined length (from kernel viewpoint) */ }; /**