Skip to content

Commit

Permalink
[SCSI] st: fix test of value range in st_set_options()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and James Bottomley committed Dec 4, 2009
1 parent 1acf3b0 commit 832151f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -2280,7 +2280,8 @@ static int st_set_options(struct scsi_tape *STp, long options)
} 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;
Expand Down

0 comments on commit 832151f

Please sign in to comment.