qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [v2] hw: misc: edu: fix 2 off-by-one errors


From: Jiri Slaby
Subject: Re: [v2] hw: misc: edu: fix 2 off-by-one errors
Date: Mon, 17 Oct 2022 08:22:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1

On 15. 10. 22, 23:10, Chris Friedt wrote:
From: Christopher Friedt <cfriedt@meta.com>

In the case that size1 was zero, because of the explicit
'end1 > addr' check, the range check would fail and the error
message would read as shown below. The correct comparison
is 'end1 >= addr' (or 'addr <= end1').

EDU: DMA range 0x40000-0x3ffff out of bounds (0x40000-0x40fff)!

At the opposite end, in the case that size1 was 4096, within()
would fail because of the non-inclusive check 'end1 < end2',
which should have been 'end1 <= end2'. The error message would
previously say

EDU: DMA range 0x40000-0x40fff out of bounds (0x40000-0x40fff)!

This change
1. renames local variables to be more less ambiguous
2. fixes the two off-by-one errors described above.

This should be split into two patches. This way, it's hard to review.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1254


thanks,
--
js
suse labs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]