If even the very first pool cannot be allocated, then pool_order is 0.
So fix warning message in this case, as reported by Coverity:
CoverityID: 451725 ("Integer handling issues")
In expression "0x1000UL << pool_order - 1", shifting by a negative
amount has undefined behavior. The shift amount, "pool_order - 1",
is -1.
Fixes:
1a6ae4b3eb ("LU-18086 sec: do not allocate empty pools")
Test-Parameters: trivial
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I45a8cf45cae3a8ed07b170d852ec5e1d096da656
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57368
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
*/
if (!pool->opp_max_ptr_pages) {
CWARN("Cannot allocate pool %i, not enough memory. Max available compression chunk is %lu.\n",
- pool_order, PAGE_SIZE << (pool_order - 1));
+ pool_order,
+ pool_order ? PAGE_SIZE << (pool_order - 1) : 0);
pools_count = pool_order;
OBD_FREE(pool, sizeof(**page_pools));
break;