Skip to contentSkip to conversation

st: fix test of value range in st_set_options()

PATCH In review [email protected] 2 participants 2 messages Nov 17, 2009 – Nov 18, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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]
Cc Willem Riede <[email protected]>
Cc James E.J. Bottomley <[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
diff -puN drivers/scsi/st.c~st-fix-test-of-value-range-in-st_set_options drivers/scsi/st.c
@@ -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;

_

Acked-by on v1 12/18
#1 lore raw
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_START 18

// vi include/scsi/scsi_cmnd.h +105
#define SCSI_SENSE_BUFFERSIZE 96

Quoted 7 lines
[[email protected]: fix warning]
Cc Willem Riede <[email protected]>
Cc James E.J. Bottomley <[email protected]>

---