Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp549031rdb; Tue, 31 Oct 2023 15:17:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxIToq4hKTPLg7zsTOoRyMSFl0Sg8s9N9nFQaWTawFuiamwi3bETM2iz8+9DEhztKn7B0m X-Received: by 2002:a17:902:d2cf:b0:1cc:45f1:adf5 with SMTP id n15-20020a170902d2cf00b001cc45f1adf5mr8053294plc.40.1698790639598; Tue, 31 Oct 2023 15:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698790639; cv=none; d=google.com; s=arc-20160816; b=wL+AFT0si3BN4TeTgsrTJdAs3sQjKEoOcHjQA+nBcMvrYr3C2d5mbsP3Z5FzgfWHzA r1PHt7pmZawUp6jQNsVO9K177jPY2wTvmiUN19r3sNAy4duwqci7FYuJK0zz6QTwKl+9 EuGL2tTs+HYXsQCA1SFhtbt6KUcrarx3Fs6dEsjARhu8tPSeoUEu34ByPLIthzrrG/PM vs8jzxgDaJAo14U0Rp1zoi9D9NCrzstnLTE0ApUk8xfGI7Ci4rqGGCU5R6GzRIvvxi6z dfQ2JUxGk3EfoDHJwzeJdBC0NDS30VP9+PzGpvYrtLP3gniL6BO/Uenxw3ESCsYa1DEU m8EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:subject:cc:to:from:date :message-id:content-transfer-encoding:mime-version; bh=MTYNnxGoYzloZZ0LrICypRpvXGG7HYPMHWKWARyDiW8=; fh=+xK4nR8I4VQskO3looC5rNisSDWudS8Rb1gnGIufZMs=; b=DAeg7ZacdEdOkpM5ovdT5cSoWnaBo/ftZ+g0FaUEszfDAJc/A/bUUxR0WhFBbbvDzd ZmeSN1BbXCHhW0E/YNJz8givFuPzgkBPVr9/jRvjj1m89vV8AiCphvu0vfZqYnMAzL6O ZSsJEjunTKQlC37F5BGVbJoAw8hNMwqMBVziMHVov8ljLk1jSWVaBC42rLLn9JsgjKw8 m5v7NU8hvgaeBVGT4ziPm9tzR3HxpWN2I/by3ETYFiXSisx4YlIPQOyFGpDxB+1GdJoL rKbYWWd5FDA9ooRFd2w2JOOrVU/ogBDyp2POFwrzEt2mf+MHHL8dGSPlkD4dGo83U26s 8QqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=stoffel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id km6-20020a17090327c600b001cc2c7a30dasi1588065plb.651.2023.10.31.15.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 15:17:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=stoffel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id AB10580725F8; Tue, 31 Oct 2023 15:17:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346350AbjJaWRJ convert rfc822-to-8bit (ORCPT + 99 others); Tue, 31 Oct 2023 18:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344917AbjJaWRI (ORCPT ); Tue, 31 Oct 2023 18:17:08 -0400 Received: from mail.stoffel.org (mail.stoffel.org [172.104.24.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AFF8F4; Tue, 31 Oct 2023 15:17:06 -0700 (PDT) Received: from quad.stoffel.org (097-095-183-072.res.spectrum.com [97.95.183.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.stoffel.org (Postfix) with ESMTPSA id 7A4C01E135; Tue, 31 Oct 2023 18:17:05 -0400 (EDT) Received: by quad.stoffel.org (Postfix, from userid 1000) id 28373A8B07; Tue, 31 Oct 2023 18:17:05 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Message-ID: <25921.31969.127938.469728@quad.stoffel.home> Date: Tue, 31 Oct 2023 18:17:05 -0400 From: "John Stoffel" To: Kent Overstreet Cc: John Stoffel , Geert Uytterhoeven , Linus Torvalds , linux-bcachefs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook Subject: Re: [GIT PULL] bcachefs for v6.7 In-Reply-To: <20231031221126.5wejfggu7gg2y3n4@moria.home.lan> References: <25921.30263.150556.245226@quad.stoffel.home> <20231031221126.5wejfggu7gg2y3n4@moria.home.lan> X-Mailer: VM 8.2.0b under 27.1 (x86_64-pc-linux-gnu) X-Spam-Status: No, score=-3.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 31 Oct 2023 15:17:16 -0700 (PDT) >>>>> "Kent" == Kent Overstreet writes: > On Tue, Oct 31, 2023 at 05:48:39PM -0400, John Stoffel wrote: >> >> Using latest HEAD from linux git (commit >> 5a6a09e97199d6600d31383055f9d43fbbcbe86f (HEAD -> master, >> origin/master, origin/HEAD), and the following config, I get this >> failure when compiling on x86_64 Debian Bullseye (11): >> >> >> CC fs/bcachefs/btree_io.o >> In file included from fs/bcachefs/btree_io.c:11: >> fs/bcachefs/btree_io.c: In function ‘bch2_btree_post_write_cleanup’: >> fs/bcachefs/btree_update_interior.h:274:36: error: array subscript 0 is outside the bounds of an interior zero-length array ‘struct bkey_packed[0]’ [-Werror=zero-length-bounds] >> 274 | __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]); >> | ^~~~~~~~~~~~~~~~~~~ >> In file included from fs/bcachefs/bcachefs.h:206, >> from fs/bcachefs/btree_io.c:3: >> fs/bcachefs/bcachefs_format.h:2344:21: note: while referencing ‘start’ >> 2344 | struct bkey_packed start[0]; >> | ^~~~~ >> In file included from fs/bcachefs/btree_io.c:11: >> fs/bcachefs/btree_io.c: In function ‘bch2_btree_init_next’: >> fs/bcachefs/btree_update_interior.h:274:36: error: array subscript 0 is outside the bounds of an interior zero-length array ‘struct bkey_packed[0]’ [-Werror=zero-length-bounds] >> 274 | __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]); >> | ^~~~~~~~~~~~~~~~~~~ >> In file included from fs/bcachefs/bcachefs.h:206, >> from fs/bcachefs/btree_io.c:3: >> fs/bcachefs/bcachefs_format.h:2344:21: note: while referencing ‘start’ >> 2344 | struct bkey_packed start[0]; >> | ^~~~~ >> cc1: all warnings being treated as errors >> make[4]: *** [scripts/Makefile.build:243: fs/bcachefs/btree_io.o] Error 1 >> make[3]: *** [scripts/Makefile.build:480: fs/bcachefs] Error 2 >> make[2]: *** [scripts/Makefile.build:480: fs] Error 2 >> make[1]: *** [/local/src/kernel/git/linux/Makefile:1913: .] Error 2 >> make: *** [Makefile:234: __sub-make] Error 2 > It seems gcc 10 complains in situations gcc 11 does not. > I've got the following patch running through my testing automation now: > -- >8 -- > From: Kent Overstreet > Date: Tue, 31 Oct 2023 18:05:22 -0400 > Subject: [PATCH] bcachefs: Fix build errors with gcc 10 > gcc 10 seems to complain about array bounds in situations where gcc 11 > does not - curious. > This unfortunately requires adding some casts for now; we may > investigate getting rid of our __u64 _data[] VLA in a future patch so > that our start[0] members can be VLAs. > Reported-by: John Stoffel > Signed-off-by: Kent Overstreet > diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h > index 29b000c6b7e1..5b44598b9df9 100644 > --- a/fs/bcachefs/bcachefs_format.h > +++ b/fs/bcachefs/bcachefs_format.h > @@ -1617,9 +1617,7 @@ struct journal_seq_blacklist_entry { > struct bch_sb_field_journal_seq_blacklist { > struct bch_sb_field field; > - > - struct journal_seq_blacklist_entry start[0]; > - __u64 _data[]; > + struct journal_seq_blacklist_entry start[]; > }; > struct bch_sb_field_errors { > diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c > index 8140b6e6e9a6..32693f7c6221 100644 > --- a/fs/bcachefs/btree_trans_commit.c > +++ b/fs/bcachefs/btree_trans_commit.c > @@ -681,7 +681,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags, > BCH_JSET_ENTRY_overwrite, i-> btree_id, i->level, i-> old_k.u64s); > - bkey_reassemble(&entry->start[0], > + bkey_reassemble((struct bkey_i *) entry->start, > (struct bkey_s_c) { &i->old_k, i->old_v }); > } > @@ -689,7 +689,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags, > BCH_JSET_ENTRY_btree_keys, i-> btree_id, i->level, i-> k->k.u64s); > - bkey_copy(&entry->start[0], i->k); > + bkey_copy((struct bkey_i *) entry->start, i->k); > } > trans_for_each_wb_update(trans, wb) { > @@ -697,7 +697,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags, > BCH_JSET_ENTRY_btree_keys, wb-> btree, 0, wb-> k.k.u64s); > - bkey_copy(&entry->start[0], &wb->k); > + bkey_copy((struct bkey_i *) entry->start, &wb->k); > } > if (trans->journal_seq) > diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c > index d029e0348c91..89ada89eafe7 100644 > --- a/fs/bcachefs/btree_update_interior.c > +++ b/fs/bcachefs/btree_update_interior.c > @@ -2411,7 +2411,7 @@ void bch2_journal_entry_to_btree_root(struct bch_fs *c, struct jset_entry *entry r-> level = entry->level; r-> alive = true; > - bkey_copy(&r->key, &entry->start[0]); > + bkey_copy(&r->key, (struct bkey_i *) entry->start); > mutex_unlock(&c->btree_root_lock); > } > diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h > index 5e0a467fe905..d92b3cf5f5e0 100644 > --- a/fs/bcachefs/btree_update_interior.h > +++ b/fs/bcachefs/btree_update_interior.h > @@ -271,7 +271,7 @@ static inline struct btree_node_entry *want_new_bset(struct bch_fs *c, > struct btree_node_entry *bne = max(write_block(b), > (void *) btree_bkey_last(b, bset_tree_last(b))); > ssize_t remaining_space = > - __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]); > + __bch_btree_u64s_remaining(c, b, bne->keys.start); > if (unlikely(bset_written(b, bset(b, t)))) { > if (remaining_space > (ssize_t) (block_bytes(c) >> 3)) > diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c > index f73338f37bf1..9600b8083175 100644 > --- a/fs/bcachefs/recovery.c > +++ b/fs/bcachefs/recovery.c > @@ -226,7 +226,7 @@ static int journal_replay_entry_early(struct bch_fs *c, > if (entry->u64s) { r-> level = entry->level; > - bkey_copy(&r->key, &entry->start[0]); > + bkey_copy(&r->key, (struct bkey_i *) entry->start); r-> error = 0; > } else { r-> error = -EIO; So this fixes the compile error, thanks! Sorry for not reporting the gcc version better. And it also compiles nicely when I remove all the BACHEFS .config entries, accept all the defaults from 'make oldconfig' and re-compile. Cheers, John