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: <20150911103159.0c94f7e3.cornelia.huck@de.ibm.com>
Date:	Fri, 11 Sep 2015 10:31:59 +0200
From:	Cornelia Huck <cornelia.huck@...ibm.com>
To:	Paolo Bonzini <pbonzini@...hat.com>
Cc:	Jason Wang <jasowang@...hat.com>, gleb@...nel.org,
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org, mst@...hat.com
Subject: Re: [PATCH V4 3/4] kvm: fix zero length mmio searching

On Fri, 11 Sep 2015 10:26:41 +0200
Paolo Bonzini <pbonzini@...hat.com> wrote:

> On 11/09/2015 05:17, Jason Wang wrote:
> > +	int len = r2->len ? r1->len : 0;
> > +
> >  	if (r1->addr < r2->addr)
> >  		return -1;
> > -	if (r1->addr + r1->len > r2->addr + r2->len)
> > +	if (r1->addr + len > r2->addr + r2->len)
> >  		return 1;
> 
> Perhaps better:
> 
> 	gpa_t addr1 = r1->addr;
> 	gpa_t addr2 = r2->addr;
> 
> 	if (addr1 < addr2)
> 		return -1;
> 
> 	/* If r2->len == 0, match the exact address.  If r2->len != 0,
> 	 * accept any overlapping write.  Any order is acceptable for
> 	 * overlapping ranges, because kvm_io_bus_get_first_dev ensures
> 	 * we process all of them.
> 	 */
> 	if (r2->len) {
> 		addr1 += r1->len;
> 		addr2 += r2->len;
> 	}
> 
> 	if (addr1 > addr2)
> 		return 1;
> 
> 	return 0;
> 

+1 to documenting what the semantics are :)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ