Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  • Arnd Bergmann's avatar
    autofs: use flexible array in ioctl structure · e910c8e3
    Arnd Bergmann authored
    Commit df8fc4e9 ("kbuild: Enable -fstrict-flex-arrays=3") introduced a warning
    for the autofs_dev_ioctl structure:
    
    In function 'check_name',
        inlined from 'validate_dev_ioctl' at fs/autofs/dev-ioctl.c:131:9,
        inlined from '_autofs_dev_ioctl' at fs/autofs/dev-ioctl.c:624:8:
    fs/autofs/dev-ioctl.c:33:14: error: 'strchr' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
       33 |         if (!strchr(name, '/'))
          |              ^~~~~~~~~~~~~~~~~
    In file included from include/linux/auto_dev-ioctl.h:10,
                     from fs/autofs/autofs_i.h:10,
                     from fs/autofs/dev-ioctl.c:14:
    include/uapi/linux/auto_dev-ioctl.h: In function '_autofs_dev_ioctl':
    include/uapi/linux/auto_dev-ioctl.h:112:14: note: source object 'path' of size 0
      112 |         char path[0];
          |              ^~~~
    
    This is easily fixed by changing the gnu 0-length array into a c99
    flexible array. Since this is a uapi structure, we have to be ...
    e910c8e3