Skip to content

Commit

Permalink
libata-scsi: use u8 array to store mode page copy
Browse files Browse the repository at this point in the history
ata_mselect_*() would initialize a char array for storing a copy of
the current mode page. However, char could be signed char. In that
case, bytes larger than 127 would be converted to negative number.

For example, 0xff from def_control_mpage[] would become -1. This
prevented ata_mselect_control() from working at all, since when it
did the read-only bits check, there would always be a mismatch.

Signed-off-by: Tom Yan <tom.ty89@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Tom Yan authored and Tejun Heo committed Aug 9, 2016
1 parent 29b4817 commit d7372cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3610,7 +3610,7 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
{
struct ata_taskfile *tf = &qc->tf;
struct ata_device *dev = qc->dev;
char mpage[CACHE_MPAGE_LEN];
u8 mpage[CACHE_MPAGE_LEN];
u8 wce;
int i;

Expand Down Expand Up @@ -3666,7 +3666,7 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
const u8 *buf, int len, u16 *fp)
{
struct ata_device *dev = qc->dev;
char mpage[CONTROL_MPAGE_LEN];
u8 mpage[CONTROL_MPAGE_LEN];
u8 d_sense;
int i;

Expand Down

0 comments on commit d7372cb

Please sign in to comment.