Move stack parameters for sed_ioctl to prevent oversized stack with CONFIG_KASAN

When CONFIG_KASAN is enabled, compilation fails:

block/sed-opal.c: In function 'sed_ioctl':
block/sed-opal.c:2447:1: error: the frame size of 2256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

Moved all the ioctl structures off the stack and dynamically allocate
using _IOC_SIZE()

Fixes: 455a7b238c ("block: Add Sed-opal library")

Reported-by: Arnd Bergmann <[email protected]>
Signed-off-by: Scott Bauer <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Scott Bauer 2017-02-14 17:29:36 -07:00 • committed by Jens Axboe
commit e225c20eb0
3 changed files with 50 additions and 90 deletions

View file

@ -789,7 +789,8 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode,
return nvme_nvm_ioctl(ns, cmd, arg);
#endif
if (is_sed_ioctl(cmd))
return sed_ioctl(&ns->ctrl->opal_dev, cmd, arg);
return sed_ioctl(&ns->ctrl->opal_dev, cmd,
(void __user *) arg);
return -ENOTTY;
}
}