Whamcloud - gitweb
LU-15420 uapi: avoid gcc-11 -Werror=stringop-overread
authorJames Simmons <jsimmons@infradead.org>
Thu, 10 Feb 2022 19:06:25 +0000 (11:06 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 9 Mar 2022 17:11:20 +0000 (17:11 +0000)
commit8b091debea9ae6f613d672a46f966278d84dafff
treed7740e3c3ba95fb131f84613fcf31dc6cc0d6fce
parent5961a965dbea14b1bcb7d241c868a6570885d219
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: TBD (from 0ae7f1196ba14df9a2354f0803eb75eea92cb1ee)

Change-Id: I13479b9074a392330d39f01656b26f9e9a91a8ec
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/46498
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/tests/mpi/Makefile.am
snmp/lustre-snmp.c