qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 3/3] memory: fix off-by-one error in memory_r


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH v3 3/3] memory: fix off-by-one error in memory_region_notify_one()
Date: Tue, 10 Oct 2017 18:13:54 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, Oct 10, 2017 at 11:42:47AM +0200, Maxime Coquelin wrote:
> This patch fixes an off-by-one error that could lead to the
> notifyee to receive notifications for ranges it is not
> registered to.
> 
> The bug has been spotted by code review.
> 
> Fixes: bd2bfa4c52e5 ("memory: introduce memory_region_notify_one()")
> Cc: address@hidden
> Cc: Peter Xu <address@hidden>
> Signed-off-by: Maxime Coquelin <address@hidden>

Thanks for fixing it!

Reviewed-by: Peter Xu <address@hidden>

> ---
>  memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/memory.c b/memory.c
> index 5e6351a6c1..b637c12bad 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1892,7 +1892,7 @@ void memory_region_notify_one(IOMMUNotifier *notifier,
>       * Skip the notification if the notification does not overlap
>       * with registered range.
>       */
> -    if (notifier->start > entry->iova + entry->addr_mask + 1 ||
> +    if (notifier->start > entry->iova + entry->addr_mask ||
>          notifier->end < entry->iova) {
>          return;
>      }
> -- 
> 2.13.6
> 

-- 
Peter Xu



reply via email to

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