Re: [GIT PULL] bcachefs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kent,

On Sat, Sep 02, 2023 at 11:25:55PM -0400, Kent Overstreet wrote:
> here's the bcachefs pull request, for 6.6. Hopefully everything
> outstanding from the previous PR thread has been resolved; the block
> layer prereqs are in now via Jens's tree and the dcache helper has a
> reviewed-by from Christain.

I pulled this into mainline locally and did an LLVM build, which found
an immediate issue. It appears the bcachefs codes uses zero length
arrays for flexible arrays instead of the C99 syntax that the kernel is
moving to, which will cause issues with -fstrict-flex-arrays=3 (clang
16+, gcc 13+), see commit df8fc4e934c1 ("kbuild: Enable
-fstrict-flex-arrays=3"). Currently, building x86_64 defconfig + the
bcachefs configs with clang warns (or errors with CONFIG_WERROR):

  In file included from fs/bcachefs/replicas.c:6:
  fs/bcachefs/replicas.h:46:2: error: array index 0 is past the end of the array (that has type '__u8[0]' (aka 'unsigned char[0]')) [-Werror,-Warray-bounds]
     46 |         e->devs[0]      = dev;
        |         ^       ~
  fs/bcachefs/bcachefs_format.h:1392:2: note: array 'devs' declared here
   1392 |         __u8                    devs[0];
        |         ^
  1 error generated.

GCC would warn in the same manner if -Warray-bounds was not disabled for
it... :(

  In file included from fs/bcachefs/buckets.c:22:
  In function 'bch2_replicas_entry_cached',
      inlined from 'update_cached_sectors' at fs/bcachefs/buckets.c:409:2,
      inlined from 'bch2_mark_alloc' at fs/bcachefs/buckets.c:590:9:
  fs/bcachefs/replicas.h:46:16: error: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Werror=array-bounds=]
     46 |         e->devs[0]      = dev;
        |         ~~~~~~~^~~
  In file included from fs/bcachefs/bcachefs.h:206,
                   from fs/bcachefs/buckets.c:8:
  fs/bcachefs/bcachefs_format.h: In function 'bch2_mark_alloc':
  fs/bcachefs/bcachefs_format.h:1392:33: note: while referencing 'devs'
   1392 |         __u8                    devs[0];
        |                                 ^~~~

GCC shows many other instances of this problem for the same reason (I
can send a build log if you'd like), such as 'struct snapshot_table' in
subvolume_types.h and several other structures in bcachefs_format.h.

Cheers,
Nathan



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux