hw/sd/sdcard: Do not attempt to erase out of range addresses
commit1bd6fd8ed5933bfba53e5f5eadebd845094c3707
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sun, 13 Sep 2020 11:18:52 +0000 (13 13:18 +0200)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Wed, 21 Oct 2020 11:34:04 +0000 (21 13:34 +0200)
treec2dc09ff8cb728a89cdbb3bab8dd5131657ae04f
parentc8c8b3f1c179e1b8d21c2e636dc893ebfc522874
hw/sd/sdcard: Do not attempt to erase out of range addresses

While the Spec v3 is not very clear, v6 states:

  If the host provides an out of range address as an argument
  to CMD32 or CMD33, the card shall indicate OUT_OF_RANGE error
  in R1 (ERX) for CMD38.

If an address is out of range, do not attempt to erase it:
return R1 with the error bit set.

Buglink: https://bugs.launchpad.net/qemu/+bug/1895310
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20201015063824.212980-6-f4bug@amsat.org>
hw/sd/sd.c