usb-ccid: make ccid_write_data_block() cope with null buffers
static code analyzer complain: hw/usb/dev-smartcard-reader.c:816:5: warning: Null pointer passed as an argument to a 'nonnull' parameter memcpy(p->abData, data, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
46bbbec2d3
commit
6b1de1484e
@ -813,7 +813,10 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
|
|||||||
if (p->b.bError) {
|
if (p->b.bError) {
|
||||||
DPRINTF(s, D_VERBOSE, "error %d\n", p->b.bError);
|
DPRINTF(s, D_VERBOSE, "error %d\n", p->b.bError);
|
||||||
}
|
}
|
||||||
memcpy(p->abData, data, len);
|
if (len) {
|
||||||
|
g_assert_nonnull(data);
|
||||||
|
memcpy(p->abData, data, len);
|
||||||
|
}
|
||||||
ccid_reset_error_status(s);
|
ccid_reset_error_status(s);
|
||||||
usb_wakeup(s->bulk, 0);
|
usb_wakeup(s->bulk, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user