linux-IllusionX/fs/fat
Helge Deller 2cd50532ce fat: use pointer to simple type in put_user()
The put_user(val,ptr) macro wants a pointer to a simple type, but in
fat_ioctl_filldir() the d_name field references an "array of chars".  Be
more accurate and explicitly give the pointer to the first character of
the d_name[] array.

I noticed that issue while trying to optimize the parisc put_user()
macro and used an intermediate variable to store the pointer.  In that
case I got this error:

  In file included from include/linux/uaccess.h:11,
                   from include/linux/compat.h:17,
                   from fs/fat/dir.c:18:
  fs/fat/dir.c: In function `fat_ioctl_filldir':
  fs/fat/dir.c:725:33: error: invalid initializer
    725 |                 if (put_user(0, d2->d_name)                     ||         \
        |                                 ^~
  include/asm/uaccess.h:152:33: note: in definition of macro `__put_user'
    152 |         __typeof__(ptr) __ptr = ptr;                            \
        |                                 ^~~
  fs/fat/dir.c:759:1: note: in expansion of macro `FAT_IOCTL_FILLDIR_FUNC'
    759 | FAT_IOCTL_FILLDIR_FUNC(fat_ioctl_filldir, __fat_dirent)

Andreas Schwab <schwab@linux-m68k.org> suggested to use

   __typeof__(&*(ptr)) __ptr = ptr;

instead.  This works, but nevertheless it's probably reasonable to fix
the original caller too.

Link: https://lkml.kernel.org/r/Ygo+A9MREmC1H3kr@p100
Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: David Laight <David.Laight@aculab.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-03-23 19:00:34 -07:00
..
.kunitconfig fat: Add KUnit tests for checksums and timestamps 2021-08-13 13:13:18 -06:00
cache.c fat: new inline functions to determine the FAT variant (32, 16 or 12) 2019-01-04 13:13:47 -08:00
dir.c fat: use pointer to simple type in put_user() 2022-03-23 19:00:34 -07:00
fat.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
fat_test.c fat: Add KUnit tests for checksums and timestamps 2021-08-13 13:13:18 -06:00
fatent.c block: move the bdi from the request_queue to the gendisk 2021-08-09 11:53:23 -06:00
file.c FAT: use io_schedule_timeout() instead of congestion_wait() 2022-01-20 08:52:54 +02:00
inode.c for-5.16/inode-sync-2021-10-29 2021-11-01 10:25:27 -07:00
Kconfig fat: Add KUnit tests for checksums and timestamps 2021-08-13 13:13:18 -06:00
Makefile fat: Add KUnit tests for checksums and timestamps 2021-08-13 13:13:18 -06:00
misc.c fat: Add KUnit tests for checksums and timestamps 2021-08-13 13:13:18 -06:00
namei_msdos.c fat: handle idmapped mounts 2021-01-24 14:43:46 +01:00
namei_vfat.c fat: handle idmapped mounts 2021-01-24 14:43:46 +01:00
nfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00