[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 9/9] ccid-card-passthru: Use size_t for index
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH v2 9/9] ccid-card-passthru: Use size_t for index |
Date: |
Fri, 15 Feb 2019 12:52:21 +0100 |
On Thu, Feb 14, 2019 at 9:27 PM Philippe Mathieu-Daudé
<address@hidden> wrote:
>
> The variable 'opt_bytes' is an index to the data[] array.
> Use size_t for indexes.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
> ---
> hw/usb/ccid-card-passthru.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
> index 083eb5ca08..664e8a1b54 100644
> --- a/hw/usb/ccid-card-passthru.c
> +++ b/hw/usb/ccid-card-passthru.c
> @@ -152,7 +152,7 @@ static void ccid_card_vscard_handle_init(
> static int check_atr(PassthruState *card, uint8_t *data, size_t len)
> {
> size_t historical_length;
> - int opt_bytes;
> + size_t opt_bytes;
> int td_count = 0;
> int td;
>
> @@ -192,12 +192,13 @@ static int check_atr(PassthruState *card, uint8_t
> *data, size_t len)
> }
> if (len > 2 + historical_length + opt_bytes) {
> DPRINTF(card, D_WARN,
> - "atr too long: len %zu, but hist/opt %zu/%d, T1 0x%X\n",
> + "atr too long: len %zu, but hist/opt %zu/%zu, T1 0x%X\n",
> len, historical_length, opt_bytes, data[1]);
> /* let it through */
> }
> DPRINTF(card, D_VERBOSE,
> - "atr passes check: %zu total length, %zu historical, %d
> optional\n",
> + "atr passes check: %zu total length,"
> + " %zu historical, %zu optional\n",
> len, historical_length, opt_bytes);
>
> return 1;
> --
> 2.20.1
>
>
--
Marc-André Lureau
- Re: [Qemu-devel] [PATCH v2 3/9] ccid-card-passthru: Assert on a stricter expression, (continued)
- [Qemu-devel] [PATCH v2 4/9] ccid-card-passthru: Let the chardev::read() be more generic, Philippe Mathieu-Daudé, 2019/02/14
- [Qemu-devel] [PATCH v2 5/9] ccid-card-passthru: Replace assert() by QEMU_BUILD_BUG_ON(), Philippe Mathieu-Daudé, 2019/02/14
- [Qemu-devel] [PATCH v2 7/9] ccid-card-passthru: Use QERR_MISSING_PARAMETER, Philippe Mathieu-Daudé, 2019/02/14
- [Qemu-devel] [PATCH v2 6/9] ccid-card-passthru: Simplify the if() condition, Philippe Mathieu-Daudé, 2019/02/14
- [Qemu-devel] [PATCH v2 9/9] ccid-card-passthru: Use size_t for index, Philippe Mathieu-Daudé, 2019/02/14
- Re: [Qemu-devel] [PATCH v2 9/9] ccid-card-passthru: Use size_t for index,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v2 8/9] ccid-card-passthru: Use size_t to hold size argument, Philippe Mathieu-Daudé, 2019/02/14