Whamcloud - gitweb
LU-13528 llite: prevent MAX_DIO_SIZE 32-bit truncation 26/38526/4
authorSebastien Buisson <sbuisson@ddn.com>
Thu, 7 May 2020 06:59:40 +0000 (08:59 +0200)
committerOleg Drokin <green@whamcloud.com>
Wed, 27 May 2020 05:04:20 +0000 (05:04 +0000)
commit8cfd5be8b04bdaaa4a0c794392cc2e6835e103eb
tree61ee58ec6fbc53ff9cd11b6b5cefb6733497d2e3
parent51b5ca6f81bd42cab906cc449c6a3e1459489d2c
LU-13528 llite: prevent MAX_DIO_SIZE 32-bit truncation

On 4kB PAGE_SIZE systems, kmalloc can allocate up to 4MB, which makes
MAX_DIO_SIZE up to 682MB. This number can fit into 32 bits.
But on 64kB PAGE_SIZE systems, kmalloc can allocate up to 512MB, which
then makes MAX_DIO_SIZE up to 1365GB. This needs 64 bits to fit.
Make sure that for every platform MAX_DIO_SIZE is not abusively
truncated, by casting it to size_t.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I9d2c8c4a1ccf0abf0b7647e569b8454365369e8a
Reviewed-on: https://review.whamcloud.com/38526
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/rw26.c