hw/usb: Fix bad printf format specifiers
PATCH 1/1 hw/usb: Fix bad printf format specifiers
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".
Reported-by Euler Robot <[email protected]>
Signed-off-by Alex Chen <[email protected]>
--- hw/usb/ccid-card-passthru.c | 2 +- hw/usb/core.c | 4 ++-- hw/usb/dev-smartcard-reader.c | 8 ++++---- hw/usb/hcd-ehci.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)
hw/usb/ccid-card-passthru.c +1 -1
@@ -335,7 +335,7 @@ static void passthru_apdu_from_guest(PassthruState *card =PASSTHRU_CCID_CARD (base);if (!qemu_chr_fe_backend_connected (&card->cs)) { -printf ("ccid-passthru: no chardev, discarding apdu length %d\n" , len); +printf ("ccid-passthru: no chardev, discarding apdu length %u\n" , len);return ; }ccid_card_vscard_send_apdu (card, apdu, len);
hw/usb/core.c +2 -2
@@ -142,7 +142,7 @@ static void do_token_setup(USBDevice *s, USBPacket *p) setup_len = (s->setup_buf[7 ] <<8 ) | s->setup_buf[6 ];if (setup_len >sizeof (s->data_buf)) {fprintf (stderr, -"usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n" , +"usb_generic_handle_packet: ctrl buffer too small (%u > %zu)\n" , setup_len,sizeof (s->data_buf)); p->status =USB_RET_STALL ;return ;
@@ -277,7 +277,7 @@ static void do_parameter(USBDevice *s, USBPacket *p) setup_len = (s->setup_buf[7 ] <<8 ) | s->setup_buf[6 ];if (setup_len >sizeof (s->data_buf)) {fprintf (stderr, -"usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n" , +"usb_generic_handle_packet: ctrl buffer too small (%u > %zu)\n" , setup_len,sizeof (s->data_buf)); p->status =USB_RET_STALL ;return ;
hw/usb/dev-smartcard-reader.c +4 -4
@@ -945,7 +945,7 @@ static void ccid_on_apdu_from_guest(USBCCIDState *s, CCID_XferBlock *recv)return ; } len =le32_to_cpu (recv->hdr.dwLength); -DPRINTF (s,1 ,"%s: seq %d, len %d\n" , __func__, +DPRINTF (s,1 ,"%s: seq %d, len %u\n" , __func__, recv->hdr.bSeq, len);ccid_add_pending_answer (s, (CCID_Header *)recv);if (s->card && len <=BULK_OUT_DATA_SIZE ) {
@@ -995,13 +995,13 @@ static void ccid_handle_bulk_out(USBCCIDState *s, USBPacket *p)if ((s->bulk_out_pos -10 < ccid_header->dwLength) && (p->iov.size ==CCID_MAX_PACKET_SIZE )) {DPRINTF (s,D_VERBOSE , -"usb-ccid: bulk_in: expecting more packets (%d/%d)\n" , +"usb-ccid: bulk_in: expecting more packets (%u/%u)\n" , s->bulk_out_pos -10 , ccid_header->dwLength);return ; }if (s->bulk_out_pos -10 != ccid_header->dwLength) {DPRINTF (s,1 , -"usb-ccid: bulk_in: message size mismatch (got %d, expected %d)\n" , +"usb-ccid: bulk_in: message size mismatch (got %u, expected %u)\n" , s->bulk_out_pos -10 , ccid_header->dwLength); goto err; }
@@ -1202,7 +1202,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card,ccid_report_error_failed (s,ERROR_HW_ERROR );return ; } -DPRINTF (s,1 ,"APDU returned to guest %d (answer seq %d, slot %d)\n" , +DPRINTF (s,1 ,"APDU returned to guest %u (answer seq %d, slot %d)\n" , len, answer->seq, answer->slot);ccid_write_data_block_answer (s, apdu, len); }
hw/usb/hcd-ehci.c +2 -2
@@ -1192,7 +1192,7 @@ static int ehci_init_transfer(EHCIPacket *p)while (bytes >0 ) {if (cpage >4 ) { -fprintf (stderr,"cpage out of range (%d)\n" , cpage); +fprintf (stderr,"cpage out of range (%u)\n" , cpage);qemu_sglist_destroy (&p->sgl);return -1 ; }
@@ -1598,7 +1598,7 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)default :/* TODO: handle FSTN type */ -fprintf (stderr,"FETCHENTRY: entry at %X is of type %d " +fprintf (stderr,"FETCHENTRY: entry at %X is of type %u " "which is not supported yet\n" , entry,NLPTR_TYPE_GET (entry));return -1 ; }
Signature · 1 line
2.19.1