Re: [Qemu-devel] [PATCH] scsi: esp: check TI buffer index before read/write

2016-05-31 Thread P J P
+-- On Tue, 31 May 2016, Peter Maydell wrote --+ | This is a FIFO *read*, and the trace message is for the case when the FIFO | is too full, which can't happen for a read. Okay. | OK, so we need to fix these code paths so that they keep all of the read, | write and size values in sync (or jus

Re: [Qemu-devel] [PATCH] scsi: esp: check TI buffer index before read/write

2016-05-31 Thread Peter Maydell
On 31 May 2016 at 06:20, P J P wrote: > Hello Peter, > > +-- On Mon, 30 May 2016, Peter Maydell wrote --+ > | > +} else if (s->ti_rptr < TI_BUFSZ) { > | > s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; > | > +} else { > | > +trace_esp_error

Re: [Qemu-devel] [PATCH] scsi: esp: check TI buffer index before read/write

2016-05-30 Thread P J P
Hello Peter, +-- On Mon, 30 May 2016, Peter Maydell wrote --+ | > +} else if (s->ti_rptr < TI_BUFSZ) { | > s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; | > +} else { | > +trace_esp_error_fifo_overrun(); | | Isn't this an underrun, not an

Re: [Qemu-devel] [PATCH] scsi: esp: check TI buffer index before read/write

2016-05-30 Thread Peter Maydell
On 30 May 2016 at 19:58, P J P wrote: > From: Prasad J Pandit > > The 53C9X Fast SCSI Controller(FSC) comes with internal 16-byte > FIFO buffers. One is used to handle commands and other is for > information transfer. While reading/writing to these buffers > an index into 's->ti_buf[TI_BUFSZ=16]'

[Qemu-devel] [PATCH] scsi: esp: check TI buffer index before read/write

2016-05-30 Thread P J P
From: Prasad J Pandit The 53C9X Fast SCSI Controller(FSC) comes with internal 16-byte FIFO buffers. One is used to handle commands and other is for information transfer. While reading/writing to these buffers an index into 's->ti_buf[TI_BUFSZ=16]' could exceed its size, as a check was missing to