On Fri, 5 Jun 2020 at 11:27, Philippe Mathieu-Daudé <phi...@redhat.com> wrote: > > I/O request length can not be negative. > > Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> > --- > hw/sd/sd.c | 2 +- > hw/sd/trace-events | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/sd/sd.c b/hw/sd/sd.c > index 9d51138b11..952be36399 100644 > --- a/hw/sd/sd.c > +++ b/hw/sd/sd.c > @@ -1950,7 +1950,7 @@ uint8_t sd_read_data(SDState *sd) > { > /* TODO: Append CRCs */ > uint8_t ret; > - int io_len; > + size_t io_len;
size_t seems an odd choice -- we initialize it with io_len = (sd->ocr & (1 << 30)) ? 512 : sd->blk_len; where sd->blk_len is a uint32_t, and we use it mainly with BLK_READ_BLOCK(sd->data_start, io_len); where BLK_READ_BLOCK is a rather unnecessary macroization of sd_blk_read(), which takes a uint32_t. thanks -- PMM