]> www.infradead.org Git - users/hch/block.git/commit
nfs: fix undefined behavior in nfs_block_bits()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Fri, 10 May 2024 20:24:04 +0000 (23:24 +0300)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 21 May 2024 12:34:15 +0000 (08:34 -0400)
commit3c0a2e0b0ae661457c8505fecc7be5501aa7a715
tree1a7a7a23b684517b38a1f96fb57323423210c09e
parenta01b077a8743b2ed329c587cf4bbe49682da243f
nfs: fix undefined behavior in nfs_block_bits()

Shifting *signed int* typed constant 1 left by 31 bits causes undefined
behavior. Specify the correct *unsigned long* type by using 1UL instead.

Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.

Cc: stable@vger.kernel.org
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/internal.h