Whamcloud - gitweb
LU-15420 uapi: avoid gcc-11 -Werror=stringop-overread 07/47707/2
authorJames Simmons <jsimmons@infradead.org>
Thu, 23 Jun 2022 06:39:07 +0000 (23:39 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 5 Jul 2022 22:13:43 +0000 (22:13 +0000)
commit7e73018fa6b25eab57c81aea5d97e0fcfdd4f0dc
treee0284b32b57c9ccc2bdcfe324e65f80d97b9d81f
parent89a6ce19c2960150af9cd9d30b934442d77b5f36
LU-15420 uapi: avoid gcc-11 -Werror=stringop-overread

GCC 11 warns about string and memory operations on fixed address:

In function ‘strlen’,
    inlined from ‘changelog_rec_sname’ at include/uapi/linux/lustre/lustre_user.h:1981:19,
    inlined from ‘mdd_changelog_rec_ext_rename’ at lustre/mdd/mdd_dir.c:932:2,
    inlined from ‘mdd_changelog_ns_store’ at lustre/mdd/mdd_dir.c:1061:3:
include/linux/fortify-string.h:25:33: error: ‘__builtin_strlen’
reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
   25 | #define __underlying_strlen     __builtin_strlen

The reason is that we are looking for an address right after the end
of the chanelog record header which gcc thinks is an overrun. Rework
the code to allow us to index the memory right after the changelog
record header.

Also fix a long hidden bug in the lustre snmp code.

Lustre-change: https://review.whamcloud.com/46319
Lustre-commit: 6331eadbd60a8c58c1c456548d067aaf772dfbaf

Change-Id: I13479b9074a392330d39f01656b26f9e9a91a8ec
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/47707
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/tests/mpi/Makefile.am
snmp/lustre-snmp.c