mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
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
1 changed files with 4 additions and 1 deletions
|
@ -813,7 +813,10 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
|
|||
if (p->b.bError) {
|
||||
DPRINTF(s, D_VERBOSE, "error %d\n", p->b.bError);
|
||||
}
|
||||
if (len) {
|
||||
g_assert_nonnull(data);
|
||||
memcpy(p->abData, data, len);
|
||||
}
|
||||
ccid_reset_error_status(s);
|
||||
usb_wakeup(s->bulk, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue