@@ -2211,6 +2211,7 @@ struct zs_pool *zs_create_pool(const char *name, u32 max_pages_per_zspage)
int i;
struct zs_pool *pool;
struct size_class *prev_class = NULL;
+ unsigned long num_pages = max_pages_per_zspage;
if (WARN_ON(max_pages_per_zspage < ZS_MIN_PAGES_PER_ZSPAGE ||
max_pages_per_zspage > ZS_MAX_PAGES_PER_ZSPAGE))
@@ -2221,8 +2222,7 @@ struct zs_pool *zs_create_pool(const char *name, u32 max_pages_per_zspage)
return NULL;
/* min_alloc_size must be multiple of ZS_ALIGN */
- pool->min_alloc_size = (max_pages_per_zspage << PAGE_SHIFT) >>
- OBJ_INDEX_BITS;
+ pool->min_alloc_size = num_pages << PAGE_SHIFT >> OBJ_INDEX_BITS;
pool->min_alloc_size = max(pool->min_alloc_size, ZS_MIN_ALLOC_SIZE);
pool->num_size_classes =
kbuild reported the following warning: mm/zsmalloc.c: In function 'zs_create_pool': mm/zsmalloc.c:2220:69: warning: right shift count >= width of type [-Wshift-count-overflow] Use unsigned long temp variable for calculations in zs_create_pool(). Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> --- mm/zsmalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)