Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libata-scsi: use u8 array to store mode page copy

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>

authored by

Tom Yan and committed by
Tejun Heo
d7372cb6 29b4817d

+2 -2
+2 -2
drivers/ata/libata-scsi.c
··· 3610 3610 { 3611 3611 struct ata_taskfile *tf = &qc->tf; 3612 3612 struct ata_device *dev = qc->dev; 3613 - char mpage[CACHE_MPAGE_LEN]; 3613 + u8 mpage[CACHE_MPAGE_LEN]; 3614 3614 u8 wce; 3615 3615 int i; 3616 3616 ··· 3666 3666 const u8 *buf, int len, u16 *fp) 3667 3667 { 3668 3668 struct ata_device *dev = qc->dev; 3669 - char mpage[CONTROL_MPAGE_LEN]; 3669 + u8 mpage[CONTROL_MPAGE_LEN]; 3670 3670 u8 d_sense; 3671 3671 int i; 3672 3672