fs/qnx4/dir.c:51:32: warning: ‘strnlen’ specified bound 48 exceeds source size 16 [-Wstringop-overread]

From: Ammar Faizi
Date: Tue May 18 2021 - 21:13:09 EST


Hi, Anders Larsen

I found that you're a maintainer:QNX4 FILESYSTEM. So I am reporting this to you.
GCC 11 warns ‘strnlen’ specified bound 48 exceeds source size 16.

fs/qnx4/dir.c: In function ‘qnx4_readdir’:
fs/qnx4/dir.c:51:32: warning: ‘strnlen’ specified bound 48 exceeds
source size 16 [-Wstringop-overread]
51 | size = strnlen(de->di_fname, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/qnx4/qnx4.h:3,
from fs/qnx4/dir.c:16:
./include/uapi/linux/qnx4_fs.h:45:25: note: source object declared here
45 | char di_fname[QNX4_SHORT_NAME_MAX];
| ^~~~~~~~

I found this warning in commit 8ac91e6c6033ebc12c5c1e4aa171b81a662bd70f
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/

commit 8ac91e6c6033ebc12c5c1e4aa171b81a662bd70f
Merge: d07f6ca923ea 54a40fc3a1da
Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date: Mon May 17 09:55:10 2021 -0700

GCC version detail:
ammarfaizi2@integral:~/project/now/linux$ gcc --version
gcc (Ubuntu 11.1.0-1ubuntu1~21.04) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Regards,
Ammar Faizi