diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-11-17 17:53:22 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:01:49 -0500 |
commit | 832151f45806613f203c4c0308c1566d882b971f (patch) | |
tree | 4ac1a4fd574094b225e00791eaf23ceb12db28b0 /drivers/scsi | |
parent | 1acf3b06f77a48b1607534408866473fb8018a65 (diff) |
[SCSI] st: fix test of value range in st_set_options()
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
[akpm@linux-foundation.org: fix warning]
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/st.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 12d58a7ed6bc..ad59abb47722 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -2280,7 +2280,8 @@ static int st_set_options(struct scsi_tape *STp, long options) | |||
2280 | } else if (code == MT_ST_SET_CLN) { | 2280 | } else if (code == MT_ST_SET_CLN) { |
2281 | value = (options & ~MT_ST_OPTIONS) & 0xff; | 2281 | value = (options & ~MT_ST_OPTIONS) & 0xff; |
2282 | if (value != 0 && | 2282 | if (value != 0 && |
2283 | value < EXTENDED_SENSE_START && value >= SCSI_SENSE_BUFFERSIZE) | 2283 | (value < EXTENDED_SENSE_START || |
2284 | value >= SCSI_SENSE_BUFFERSIZE)) | ||
2284 | return (-EINVAL); | 2285 | return (-EINVAL); |
2285 | STp->cln_mode = value; | 2286 | STp->cln_mode = value; |
2286 | STp->cln_sense_mask = (options >> 8) & 0xff; | 2287 | STp->cln_sense_mask = (options >> 8) & 0xff; |