]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/shmem.c: suppress shift warning
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 25 May 2022 22:17:09 +0000 (15:17 -0700)
committerakpm <akpm@linux-foundation.org>
Fri, 27 May 2022 16:33:47 +0000 (09:33 -0700)
mm/shmem.c:1948 shmem_getpage_gfp() warn: should '(((1) << 12) / 512) << folio_order(folio)' be a 64 bit type?

On i386, so an unsigned long is 32-bit, but i_blocks is a 64-bit blkcnt_t.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Jessica Clarke <jrtc27@jrtc27.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c

index 54149ce679be4f7d4b3ed556b3118c9a0c84bad6..c24f684022fd04ecad93639f0a2c2ee2916a3590 100644 (file)
@@ -1945,7 +1945,7 @@ alloc_nohuge:
 
        spin_lock_irq(&info->lock);
        info->alloced += folio_nr_pages(folio);
-       inode->i_blocks += BLOCKS_PER_PAGE << folio_order(folio);
+       inode->i_blocks += (blkcnt_t)BLOCKS_PER_PAGE << folio_order(folio);
        shmem_recalc_inode(inode);
        spin_unlock_irq(&info->lock);
        alloced = true;