]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit - repair/dinode.c
misc: fix unsigned integer comparison complaints
authorDarrick J. Wong <djwong@kernel.org>
Tue, 12 Jul 2022 18:19:33 +0000 (13:19 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 12 Jul 2022 18:19:33 +0000 (13:19 -0500)
commit95e3fc7f38057ee1d511c12f45e69aceedcbffb7
tree3a9a0fef30b1690c289994ef75419c055fb85a9a
parente298041ea1efe1473fea04e9d44d2c2a388f74a1
misc: fix unsigned integer comparison complaints

gcc 11.2 complains about certain variables now that xfs_extnum_t is an
unsigned 64-bit integer:

dinode.c: In function ‘process_exinode’:
dinode.c:960:21: error: comparison of unsigned expression in ‘< 0’ is always false [-Werror=type-limits]
  960 |         if (numrecs < 0)

Since we actually have a function that will tell us the maximum
supported extent count for an ondisk dinode structure, use a direct
comparison instead of tricky integer math to detect overflows.  A more
exhaustive audit is probably necessary.

IOWS, shut up, gcc...

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/check.c
db/metadump.c
repair/dinode.c