From patchwork Mon Nov 6 21:40:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 162199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2943851vqu; Mon, 6 Nov 2023 13:41:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IF42UkI78oGjoOuA8ZBy5h+qHVA7pC/WPiIxRh5p8N9zNRorxnIQZo+E0eLmG595MnlTJNp X-Received: by 2002:a17:903:2291:b0:1cc:4fe8:c6c8 with SMTP id b17-20020a170903229100b001cc4fe8c6c8mr22411599plh.6.1699306917959; Mon, 06 Nov 2023 13:41:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699306917; cv=none; d=google.com; s=arc-20160816; b=uj1G7xav10fb2X9+giwYHJvyZw9QbJ/sDtS5jQg8sG3ZRMQeuPwzOpZebB5ZT9kclE yEpL7t7Pck1Vfd2mpWDH76k3TTVNn6oNWmdZQGISiWabw7SeOmokRheHRwCkeZ9AqG5v 8r0PdsRj72Rv/ogcJR+/LoIfvr6yFAuBvhKc5F2HK2pGByhcXXAzwAM0fyIDScgV4kng ZXjEZ6XxidfU9/d+BDv5ktylHY5vYbJCT0n4ZLTAqblWKadZ8hFJT6yrzMu5wKDCqIO9 617VRc5OJURtanozrUt2LMmlF4HYO4znCssy7YrVREApMcOZA8PM58xHgiF8nQFUUpjL lFYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=ReQice1s9pMoA8UuwIKdJc7pXC5hSoRHb/P7kfsLg1E=; fh=a9DUR2BkWEeP0cACbiaI2xwcDvDVC/gt15O7/cIFKdk=; b=RdCdajINkgyIqg7jmy4D/VSRQTDi9tgcSJ75l0d16MJgPK5RxH7V+2HqeyaoTFQoXv cAfB3WWme9f6j2cO6aDuLgVF1UvWh0+emGPoxwleljI0Rdf9B+b9kZxTydYSukt8Zj23 HdsiNhBjoISYjMWEt1IlAP327+S+IFAo0ZbgqOtjUUZbb99rBdxknhPxq+6JqNVdUKt+ vzBeX2WVgZPtqdwz53my493Zw7FNtDs8OiMaeAMIYyyMGVlaAYLD7oDdOlGFZ0gkaQac ko/rJD/RsKg4WrhDGzgUdwsWflefPckNox8tvAc2ckDPQ9yJPa35+c2yWrb2chPOkT5F wNNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i6oviTFN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id kh7-20020a170903064700b001cc0c0f6332si8581087plb.70.2023.11.06.13.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 13:41:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i6oviTFN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D543B8092EF9; Mon, 6 Nov 2023 13:40:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233174AbjKFVkb (ORCPT + 34 others); Mon, 6 Nov 2023 16:40:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233132AbjKFVk2 (ORCPT ); Mon, 6 Nov 2023 16:40:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34D11BB; Mon, 6 Nov 2023 13:40:26 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29F6DC433C7; Mon, 6 Nov 2023 21:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699306825; bh=+FlwfuDUvVPFaF514DQDx020nBoDR412BR5BhhOaIUU=; h=Date:From:To:Cc:Subject:From; b=i6oviTFNJJgL/F00kQA4tzkaef5Fij8X9EzWV19SYaqbwwMj2i8HshOtWuNJ8JmFe TbNFqqv7X2bwjOjYkj64yT6jfJ4qz6Eei9JM7+cxH6HXRQGahfzG1owbxhgZnH+oBA ROZsbQGOFtmGEEmmUHZhgRpdMinJ7IFw1B9J6a/SUPht0bfjsA78aIiga3xEY6BnmV dBR32BmRWkmoPiVUYJRLnWA6ePf7AM2b201vNla+z8msEbeEAMxOv8/nH3y0n7Gdc2 AG0X/gLfyq7DHfU6CVwNp5HFe2VRdreC9c9IWDkGnGiY0AKSNqxHg+9GbGwi//FXTY EAtQtVW0bMRLg== Date: Mon, 6 Nov 2023 15:40:22 -0600 From: "Gustavo A. R. Silva" To: Kent Overstreet , Brian Foster Cc: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] bcachefs: Fix multiple -Warray-bounds warnings Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 13:40:42 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781852451084743721 X-GMAIL-MSGID: 1781852451084743721 Transform zero-length array `entries` into a proper flexible-array member in `struct journal_seq_blacklist_table`; and fix the following -Warray-bounds warnings: fs/bcachefs/journal_seq_blacklist.c:148:26: warning: array subscript idx is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] fs/bcachefs/journal_seq_blacklist.c:150:30: warning: array subscript idx is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] fs/bcachefs/journal_seq_blacklist.c:154:27: warning: array subscript idx is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] fs/bcachefs/journal_seq_blacklist.c:176:27: warning: array subscript i is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] fs/bcachefs/journal_seq_blacklist.c:177:27: warning: array subscript i is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] fs/bcachefs/journal_seq_blacklist.c:297:34: warning: array subscript i is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] fs/bcachefs/journal_seq_blacklist.c:298:34: warning: array subscript i is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] fs/bcachefs/journal_seq_blacklist.c:300:31: warning: array subscript i is outside array bounds of 'struct journal_seq_blacklist_table_entry[0]' [-Warray-bounds=] This results in no differences in binary output. This helps with the ongoing efforts to globally enable -Warray-bounds. Signed-off-by: Gustavo A. R. Silva --- fs/bcachefs/bcachefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 53ffa88cae16..e42f2977f7aa 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -612,7 +612,7 @@ struct journal_seq_blacklist_table { u64 start; u64 end; bool dirty; - } entries[0]; + } entries[]; }; struct journal_keys {