Re: [PATCH v2 2/4] hw/scsi/megasas: Assert cdb_len is valid in megasas_handle_scsi()

2020-12-03 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年12月3日周四 下午8:38写道: > > On 12/3/20 1:02 PM, Li Qiang wrote: > > Philippe Mathieu-Daudé 于2020年12月3日周四 下午7:37写道: > >> > >> Hi Li, > >> > >> On 12/3/20 12:21 PM, Li Qiang wrote: > >>> Philippe Mathieu-Daudé 于2020年12月2日周三 上午3:13写道: > > cdb_len can not be zero...

Re: [PATCH v2 2/4] hw/scsi/megasas: Assert cdb_len is valid in megasas_handle_scsi()

2020-12-03 Thread Philippe Mathieu-Daudé
On 12/3/20 1:02 PM, Li Qiang wrote: > Philippe Mathieu-Daudé 于2020年12月3日周四 下午7:37写道: >> >> Hi Li, >> >> On 12/3/20 12:21 PM, Li Qiang wrote: >>> Philippe Mathieu-Daudé 于2020年12月2日周三 上午3:13写道: cdb_len can not be zero... (or less than 6) here, else we have a out-of-bound read first

Re: [PATCH v2 2/4] hw/scsi/megasas: Assert cdb_len is valid in megasas_handle_scsi()

2020-12-03 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年12月3日周四 下午7:37写道: > > Hi Li, > > On 12/3/20 12:21 PM, Li Qiang wrote: > > Philippe Mathieu-Daudé 于2020年12月2日周三 上午3:13写道: > >> > >> cdb_len can not be zero... (or less than 6) here, else we have a > >> out-of-bound read first in scsi_cdb_length(): > >> > >> 71 int

Re: [PATCH v2 2/4] hw/scsi/megasas: Assert cdb_len is valid in megasas_handle_scsi()

2020-12-03 Thread Philippe Mathieu-Daudé
Hi Li, On 12/3/20 12:21 PM, Li Qiang wrote: > Philippe Mathieu-Daudé 于2020年12月2日周三 上午3:13写道: >> >> cdb_len can not be zero... (or less than 6) here, else we have a >> out-of-bound read first in scsi_cdb_length(): >> >> 71 int scsi_cdb_length(uint8_t *buf) >> 72 { >> 73 int cdb_len; >> 74

Re: [PATCH v2 2/4] hw/scsi/megasas: Assert cdb_len is valid in megasas_handle_scsi()

2020-12-03 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年12月2日周三 上午3:13写道: > > cdb_len can not be zero... (or less than 6) here, else we have a > out-of-bound read first in scsi_cdb_length(): > > 71 int scsi_cdb_length(uint8_t *buf) > 72 { > 73 int cdb_len; > 74 > 75 switch (buf[0] >> 5) { Hi Philippe, Here I

[PATCH v2 2/4] hw/scsi/megasas: Assert cdb_len is valid in megasas_handle_scsi()

2020-12-01 Thread Philippe Mathieu-Daudé
cdb_len can not be zero... (or less than 6) here, else we have a out-of-bound read first in scsi_cdb_length(): 71 int scsi_cdb_length(uint8_t *buf) 72 { 73 int cdb_len; 74 75 switch (buf[0] >> 5) { 76 case 0: 77 cdb_len = 6; 78 break; Then another out-of-bound