]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/sd/sdbus: Provide buffer size to sdbus_do_command()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 31 Jul 2025 11:55:25 +0000 (13:55 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 5 Aug 2025 14:05:56 +0000 (16:05 +0200)
commitb82e7a2a1da5638c4c51fcf5a254b65762080b85
tree8035e0e041a5c64a9bfdfdcaa06dc56bca81f688
parent3025ea65bd515196e871adc8959336c51b9d27bc
hw/sd/sdbus: Provide buffer size to sdbus_do_command()

We provide to sdbus_do_command() a pointer to a buffer to be
filled with a varying number of bytes. By not providing the
buffer size, the callee can not check the buffer is big enough.
Pass the buffer size as argument to follow good practices.

sdbus_do_command() doesn't return any error, only the size filled
in the buffer. Convert the returned type to unsigned and remove
the few unreachable lines in callers.

This allow to check for possible overflow in sd_do_command().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250804133406.17456-4-philmd@linaro.org>
hw/sd/allwinner-sdhost.c
hw/sd/bcm2835_sdhost.c
hw/sd/core.c
hw/sd/omap_mmc.c
hw/sd/pl181.c
hw/sd/sd.c
hw/sd/sdhci.c
hw/sd/ssi-sd.c
include/hw/sd/sd.h