Hi, This series emerged after last Coverity scan and Peter suggestion in: http://lists.nongnu.org/archive/html/qemu-devel/2018-04/msg05046.html
(3) "proper" implementation of CRC, so that an sd controller can either (a) mark the SDRequest as "no CRC" and have sd_req_crc_validate() always pass, or (b) mark the SDRequest as having a CRC and have sd_req_crc_validate() actually do the check which it currently stubs out with "return 0" - Coverity issues fixed - new functions documented - qtests added This series would be much smaller without qtests (less refactor and code movement), but I feel more confident having them passing :) v2: - simplified (do not touch CRC16: less code added) - added R-b v1: http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg01130.html Regards, Phil. Philippe Mathieu-Daudé (14): sdcard: Use the ldst API sdcard: Constify sd_crc*()'s message argument sdcard: Fix sd_crc*() style sdcard: Extract sd_frame48/136_calc_checksum() sdcard: Move sd_crc7() and calc_checksum() out for qtesting sdcard: Add test_sd_verify_cksum_frame136() sdcard: Invert the sd_req_crc_is_valid() logic sdcard: Extract sd_frame48_verify_checksum() out for qtesting sdcard: Add sd_frame136_verify_checksum() sdcard: Remove the SDRequest argument from internal functions sdcard: Add sd_frame48_init(), replace SDRequest by a raw buffer sdcard: Add tests to validate the 7-bit CRC checksum of 48-bit SD frame sdcard: Add a "validate-crc" property hw/sd/ssi-sd: Enable CRC validation include/hw/sd/sd.h | 64 +++++++++++++--- hw/sd/bcm2835_sdhost.c | 21 +++--- hw/sd/core.c | 7 +- hw/sd/milkymist-memcard.c | 14 +--- hw/sd/omap_mmc.c | 14 ++-- hw/sd/pl181.c | 21 +++--- hw/sd/pxa2xx_mmci.c | 8 +- hw/sd/sd.c | 153 ++++++++++++++++++-------------------- hw/sd/sdhci.c | 35 ++++----- hw/sd/sdmmc-internal.c | 59 +++++++++++++++ hw/sd/ssi-sd.c | 19 ++--- tests/sdcard-test.c | 121 ++++++++++++++++++++++++++++++ tests/Makefile.include | 4 + 13 files changed, 369 insertions(+), 171 deletions(-) create mode 100644 tests/sdcard-test.c -- 2.17.0