sg: prevent integer overflow when converting from sectors to bytes
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 2 Jun 2014 13:56:46 +0000 (22:56 +0900)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 11 Jun 2020 18:05:42 +0000 (19:05 +0100)
commitfc23502b1025b597c6cf4b479b52a466724944a1
treed35b30afbfdcdb0be08dad0e7156ac3e627815ba
parent3a27c0defb0315760100f8b1adc7c4acbe04c884
sg: prevent integer overflow when converting from sectors to bytes

commit 46f69e6a6bbbf3858617c8729e31895846c15a79 upstream.

This prevents integer overflow when converting the request queue's
max_sectors from sectors to bytes.  However, this is a preparation for
extending the data type of max_sectors in struct Scsi_Host and
scsi_host_template.  So, it is impossible to happen this integer
overflow for now, because SCSI low-level drivers can not specify
max_sectors greater than 0xffff due to the data type limitation.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/sg.c