]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: Check sense buffer size at build time
authorKees Cook <keescook@chromium.org>
Tue, 31 Jul 2018 19:51:54 +0000 (12:51 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 2 Aug 2018 21:23:51 +0000 (15:23 -0600)
commit482a5e15917d8f31656b0180d71d179c7318b00c
tree6603bc65758e0c761fc773b8341bf9875dc5fe76
parentca223a65fab653fa2b258a01e2ca1619ba6ca761
scsi: Check sense buffer size at build time

To avoid introducing problems like those fixed in commit e1539de00981
("sr: pass down correctly sized SCSI sense buffer"), this creates a macro
wrapper for scsi_execute() that verifies the size of the sense buffer
similar to what was done for command string sizes in commit c4de18674f03
("exec: avoid gcc-8 warning for get_task_comm").

Another solution could be to add a length argument to scsi_execute(),
but this function already takes a lot of arguments and Jens was not fond
of that approach.

Additionally, this moves the SCSI_SENSE_BUFFERSIZE definition into
scsi_device.h, and removes a redundant include for scsi_device.h from
scsi_cmnd.h.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/scsi/scsi_lib.c
include/scsi/scsi_cmnd.h
include/scsi/scsi_device.h