On Thu, Feb 14, 2019 at 9:20 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> hw/usb/ccid-card-passthru.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
> index ba7c285ded..ccc3ffa7fa 100644
> --- a/hw/usb/ccid-card-passthru.c
> +++ b/hw/usb/ccid-card-passthru.c
> @@ -29,6 +29,9 @@ do { \
> #define D_MORE_INFO 3
> #define D_VERBOSE 4
>
> +/* maximum size of ATR - from 7816-3 */
> +#define MAX_ATR_SIZE 40
> +
> /* TODO: do we still need this? */
> static const uint8_t DEFAULT_ATR[] = {
> /*
> @@ -41,10 +44,9 @@ static const uint8_t DEFAULT_ATR[] = {
> 0x13, 0x08
> };
>
> -#define VSCARD_IN_SIZE (64 * KiB)
> +QEMU_BUILD_BUG_ON(sizeof(DEFAULT_ATR) > MAX_ATR_SIZE);
>
> -/* maximum size of ATR - from 7816-3 */
> -#define MAX_ATR_SIZE 40
> +#define VSCARD_IN_SIZE (64 * KiB)
>
> typedef struct PassthruState PassthruState;
>
> @@ -351,7 +353,6 @@ static void passthru_realize(CCIDCardState *base, Error **errp)
> }
> card->debug = parse_debug_env("QEMU_CCID_PASSTHRU_DEBUG", D_VERBOSE,
> card->debug);
> - assert(sizeof(DEFAULT_ATR) <= MAX_ATR_SIZE);
> memcpy(card->atr, DEFAULT_ATR, sizeof(DEFAULT_ATR));
> card->atr_length = sizeof(DEFAULT_ATR);
> }
> --
> 2.20.1
>