[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 08/11] hw/sd/sdcard: Make iolen unsigned
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 08/11] hw/sd/sdcard: Make iolen unsigned |
Date: |
Mon, 15 Jun 2020 15:13:11 +0100 |
On Fri, 5 Jun 2020 at 11:27, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> I/O request length can not be negative.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@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
- [PATCH v3 03/11] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid, (continued)
- [PATCH v3 03/11] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v3 04/11] hw/sd/sdcard: Restrict Class 6 commands to SCSD cards, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v3 05/11] hw/sd/sdcard: Update the SDState documentation, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v3 06/11] hw/sd/sdcard: Simplify cmd_valid_while_locked(), Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v3 07/11] hw/sd/sdcard: Constify sd_crc*()'s message argument, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v3 08/11] hw/sd/sdcard: Make iolen unsigned, Philippe Mathieu-Daudé, 2020/06/05
- Re: [PATCH v3 08/11] hw/sd/sdcard: Make iolen unsigned,
Peter Maydell <=
- [PATCH v3 09/11] hw/sd/sdcard: Correctly display the command name in trace events, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v3 10/11] hw/sd/sdcard: Display offset in read/write_data() trace events, Philippe Mathieu-Daudé, 2020/06/05
- [PATCH v3 11/11] hw/sd/sdcard: Simplify realize() a bit, Philippe Mathieu-Daudé, 2020/06/05
- Re: [PATCH v3 00/11] hw/sd/sdcard: Fix CVE-2020-13253 & cleanups, Philippe Mathieu-Daudé, 2020/06/08
- Re: [PATCH v3 00/11] hw/sd/sdcard: Fix CVE-2020-13253 & cleanups, Philippe Mathieu-Daudé, 2020/06/15