https://github.com/torvalds/linux
Revision 13402837414070492004cd0a9c80b5fcebbd1a9e authored by Linus Torvalds on 19 April 2020, 17:34:30 UTC, committed by Linus Torvalds on 19 April 2020, 17:34:30 UTC
Pull flexible-array member conversion from Gustavo Silva:
 "The current codebase makes use of the zero-length array language
  extension to the C90 standard, but the preferred mechanism to declare
  variable-length types such as these ones is a flexible array
  member[1][2], introduced in C99:

    struct foo {
        int stuff;
        struct boo array[];
    };

  By making use of the mechanism above, we will get a compiler warning
  in case the flexible array does not occur last in the structure, which
  will help us prevent some kind of undefined behavior bugs from being
  inadvertently introduced[3] to the codebase from now on.

  Also, notice that, dynamic memory allocations won't be affected by
  this change:

   "Flexible array members have incomplete type, and so the sizeof
    operator may not be applied. As a quirk of the original
    implementation of zero-length arrays, sizeof evaluates to zero."[1]

  sizeof(flexible-array-member) triggers a warning because flexible
  array members have incomplete type[1]. There are some instances of
  code in which the sizeof operator is being incorrectly/erroneously
  applied to zero-length arrays and the result is zero. Such instances
  may be hiding some bugs. So, this work (flexible-array member
  convertions) will also help to get completely rid of those sorts of
  issues.

  Notice that all of these patches have been baking in linux-next for
  quite a while now and, 238 more of these patches have already been
  merged into 5.7-rc1.

  There are a couple hundred more of these issues waiting to be
  addressed in the whole codebase"

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

* tag 'flexible-array-member-5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux: (28 commits)
  xattr.h: Replace zero-length array with flexible-array member
  uapi: linux: fiemap.h: Replace zero-length array with flexible-array member
  uapi: linux: dlm_device.h: Replace zero-length array with flexible-array member
  tpm_eventlog.h: Replace zero-length array with flexible-array member
  ti_wilink_st.h: Replace zero-length array with flexible-array member
  swap.h: Replace zero-length array with flexible-array member
  skbuff.h: Replace zero-length array with flexible-array member
  sched: topology.h: Replace zero-length array with flexible-array member
  rslib.h: Replace zero-length array with flexible-array member
  rio.h: Replace zero-length array with flexible-array member
  posix_acl.h: Replace zero-length array with flexible-array member
  platform_data: wilco-ec.h: Replace zero-length array with flexible-array member
  memcontrol.h: Replace zero-length array with flexible-array member
  list_lru.h: Replace zero-length array with flexible-array member
  lib: cpu_rmap: Replace zero-length array with flexible-array member
  irq.h: Replace zero-length array with flexible-array member
  ihex.h: Replace zero-length array with flexible-array member
  igmp.h: Replace zero-length array with flexible-array member
  genalloc.h: Replace zero-length array with flexible-array member
  ethtool.h: Replace zero-length array with flexible-array member
  ...
2 parent s 50cc09c + 4395158
History
Tip revision: 13402837414070492004cd0a9c80b5fcebbd1a9e authored by Linus Torvalds on 19 April 2020, 17:34:30 UTC
Merge tag 'flexible-array-member-5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
Tip revision: 1340283
File Mode Size
Kconfig -rw-r--r-- 551 bytes
Makefile -rw-r--r-- 365 bytes
attributes.c -rw-r--r-- 8.7 KB
bfind.c -rw-r--r-- 6.1 KB
bitmap.c -rw-r--r-- 5.0 KB
bnode.c -rw-r--r-- 15.3 KB
brec.c -rw-r--r-- 13.6 KB
btree.c -rw-r--r-- 12.2 KB
catalog.c -rw-r--r-- 14.1 KB
dir.c -rw-r--r-- 13.8 KB
extents.c -rw-r--r-- 15.5 KB
hfsplus_fs.h -rw-r--r-- 16.8 KB
hfsplus_raw.h -rw-r--r-- 9.5 KB
inode.c -rw-r--r-- 17.1 KB
ioctl.c -rw-r--r-- 3.7 KB
options.c -rw-r--r-- 5.3 KB
part_tbl.c -rw-r--r-- 4.2 KB
super.c -rw-r--r-- 17.9 KB
tables.c -rw-r--r-- 119.1 KB
unicode.c -rw-r--r-- 10.5 KB
wrapper.c -rw-r--r-- 7.0 KB
xattr.c -rw-r--r-- 23.3 KB
xattr.h -rw-r--r-- 1.2 KB
xattr_security.c -rw-r--r-- 2.0 KB
xattr_trusted.c -rw-r--r-- 1017 bytes
xattr_user.c -rw-r--r-- 963 bytes

back to top