lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9Jb+iiLy-7BB7J3S2yiEhWpn1VxKG_VuwGK82gq0+=8QvQKw@mail.gmail.com>
Date:   Tue, 20 Oct 2020 11:22:45 +0200
From:   Pankaj Gupta <pankaj.gupta.linux@...il.com>
To:     David Hildenbrand <david@...hat.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, Linux MM <linux-mm@...ck.org>,
        virtualization@...ts.linux-foundation.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Michael S . Tsirkin" <mst@...hat.com>,
        Jason Wang <jasowang@...hat.com>
Subject: Re: [PATCH v1 07/29] virtio-mem: generalize virtio_mem_overlaps_range()

> Avoid using memory block ids. While at it, use uint64_t for
> address/size.
>
> Cc: "Michael S. Tsirkin" <mst@...hat.com>
> Cc: Jason Wang <jasowang@...hat.com>
> Cc: Pankaj Gupta <pankaj.gupta.linux@...il.com>
> Signed-off-by: David Hildenbrand <david@...hat.com>
> ---
>  drivers/virtio/virtio_mem.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index 821143db14fe..37a0e338ae4a 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -489,14 +489,10 @@ static int virtio_mem_translate_node_id(struct virtio_mem *vm, uint16_t node_id)
>   * Test if a virtio-mem device overlaps with the given range. Can be called
>   * from (notifier) callbacks lockless.
>   */
> -static bool virtio_mem_overlaps_range(struct virtio_mem *vm,
> -                                     unsigned long start, unsigned long size)
> +static bool virtio_mem_overlaps_range(struct virtio_mem *vm, uint64_t start,
> +                                     uint64_t size)
>  {
> -       unsigned long dev_start = virtio_mem_mb_id_to_phys(vm->first_mb_id);
> -       unsigned long dev_end = virtio_mem_mb_id_to_phys(vm->last_mb_id) +
> -                               memory_block_size_bytes();
> -
> -       return start < dev_end && dev_start < start + size;
> +       return start < vm->addr + vm->region_size && vm->addr < start + size;
>  }

Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ