ide: Fix off-by-one error in array index check

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Kevin Wolf 2011-10-26 11:52:47 +02:00
parent 64ebe71aa0
commit fb60105d49

View File

@ -2039,7 +2039,7 @@ static int ide_drive_pio_post_load(void *opaque, int version_id)
{
IDEState *s = opaque;
if (s->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) {
if (s->end_transfer_fn_idx >= ARRAY_SIZE(transfer_end_table)) {
return -EINVAL;
}
s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];