st: fix test of value range in st_set_options()
Subsystems (2)
PATCH 12/18 st: fix test of value range in st_set_options()
From: Roel Kluin <[email protected]>
value cannot logically be less than START and greater than BUFFERSIZE.
#define EXTENDED_SENSE_START 18
// vi include/scsi/scsi_cmnd.h +105
#define SCSI_SENSE_BUFFERSIZE 96
[[email protected]: fix warning]
Signed-off-by Roel Kluin <[email protected]>
Cc Willem Riede <[email protected]>
Cc James E.J. Bottomley <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/scsi/st.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/st.c renamed from drivers/scsi/st.c~st-fix-test-of-value-range-in-st_set_options +2 -1
@@ -2280,7 +2280,8 @@ static int st_set_options(struct scsi_ta }else if (code ==MT_ST_SET_CLN ) { value = (options & ~MT_ST_OPTIONS ) &0xff ;if (value !=0 && - value <EXTENDED_SENSE_START && value >=SCSI_SENSE_BUFFERSIZE ) + (value <EXTENDED_SENSE_START || + value >=SCSI_SENSE_BUFFERSIZE ))return (-EINVAL ); STp->cln_mode = value; STp->cln_sense_mask = (options >>8 ) &0xff ;
_
Quoted 9 lines · On Tue, 17 Nov 2009, [email protected] wrote:
From: Roel Kluin <[email protected]>
value cannot logically be less than START and greater than BUFFERSIZE.
#define
EXTENDED_SENSE_START18// vi
include/scsi/scsi_cmnd.h+105
#defineSCSI_SENSE_BUFFERSIZE96
Quoted 7 lines
[[email protected]: fix warning]Signed-off-by Roel Kluin <[email protected]>Cc Willem Riede <[email protected]>Cc James E.J. Bottomley <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
Acked-by Kai Makisara <[email protected]>