From de2f203d2bcdd29570f74ea164241e0791389494 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 19 Aug 2016 09:20:46 +1000 Subject: [PATCH] libxfs: fix xfs_isset pointer calculation In the macro xfs_isset, the variable 'a' is a pointer to an array type. However, the bit offset calculation uses sizeof(a), which returns the size of the pointer, not the size of an array element. Fix this, which also fixes the problem where xfs_check spits out bogus "rtblock X expected type unknown, got rtfree" messages. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- include/libxfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libxfs.h b/include/libxfs.h index c182fa159..1e6d1d3a7 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -87,7 +87,7 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len); #define XFS_SUPER_MAGIC 0x58465342 #endif -#define xfs_isset(a,i) ((a)[(i)/(sizeof((a))*NBBY)] & (1<<((i)%(sizeof((a))*NBBY)))) +#define xfs_isset(a,i) ((a)[(i)/(sizeof(*(a))*NBBY)] & (1ULL<<((i)%(sizeof(*(a))*NBBY)))) /* * Argument structure for libxfs_init(). -- 2.47.2