LU-17000 libcfs: quiet Coverity LIBCFS_ALLOC warning
Coverity has a frequent but harmeless warning in LIBCFS_ALLOC_PRE():
logical_vs_bitwise: The expression
cptab->ctb_nparts * 4UL /* sizeof (*part->cpt_distance) */ <=
(8192UL /* 2 << 12 */) && 1
/* ((gfp_t)(0x200000U | 0x400000U) | (gfp_t)64U) &
(((gfp_t)32U | (gfp_t)524288U) | (gfp_t)4194304U) */
is suspicious because it performs a Boolean operation on a
constant other than 0 or 1.
Fix by comparing GFP mask to zero, rather than the whole expression.
There are many similar CIDs, only listing a couple for reference.
Add a Git commit-msg hook check for CoverityID: in commit messages,
and test cases for the same.
Test-Parameters: trivial
CoverityID: 397137 ("Logical vs. bitwise operator")
CoverityID: 397837 ("Logical vs. bitwise operator")
Fixes:
3a92c850b0 ("LU-56 libcfs: NUMA allocator and code cleanup")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I4691d9611f752b8a58f3ed1d5e0830b24da39648
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57408
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>