mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/rtc/mc146818rtc: Assert correct usage of mc146818rtc_set_cmos_data()
The offset is never controlled by the guest, so any misuse constitutes a programming error and shouldn't be silently ignored. Fix this by using assert(). Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20251019210303.104718-6-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
committed by
Philippe Mathieu-Daudé
parent
3006fa8d26
commit
f3c0c9da66
@@ -726,9 +726,8 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr,
|
||||
|
||||
void mc146818rtc_set_cmos_data(MC146818RtcState *s, int addr, int val)
|
||||
{
|
||||
if (addr >= 0 && addr < ARRAY_SIZE(s->cmos_data)) {
|
||||
s->cmos_data[addr] = val;
|
||||
}
|
||||
assert(addr >= 0 && addr < ARRAY_SIZE(s->cmos_data));
|
||||
s->cmos_data[addr] = val;
|
||||
}
|
||||
|
||||
int mc146818rtc_get_cmos_data(MC146818RtcState *s, int addr)
|
||||
|
||||
Reference in New Issue
Block a user