On Tue, Sep 14, 2021 at 11:30:03AM -0700, Linus Torvalds wrote: > case NBD_SET_SIZE_BLOCKS: > - if (check_mul_overflow((loff_t)arg, config->blksize, &bytesize)) > + bytesize = arg << config->blksize_bits; > + if (bytesize >> config->blksize_bits != arg) > return -EINVAL; FWIW, it's probably better to avoid open-coding the check. There are helpers for shift-left too. :) + if (check_shl_overflow(arg, config->blksize_bits, &bytesize)) -- Kees Cook