Message ID | 20181129152905.23726-1-drjones@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kvm: selftests: ucall: fix unsigned comparison | expand |
On Thu, Nov 29, 2018 at 04:29:05PM +0100, Andrew Jones wrote: > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > tools/testing/selftests/kvm/lib/ucall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/lib/ucall.c b/tools/testing/selftests/kvm/lib/ucall.c > index 4777f9bb5194..e28bdd6b546c 100644 > --- a/tools/testing/selftests/kvm/lib/ucall.c > +++ b/tools/testing/selftests/kvm/lib/ucall.c > @@ -58,7 +58,7 @@ void ucall_init(struct kvm_vm *vm, ucall_type_t type, void *arg) > start = 1ul << (vm->va_bits * 2 / 3); > end = 1ul << vm->va_bits; > step = 1ul << (vm->va_bits / 6); > - for (gpa = start; gpa >= 0; gpa -= step) { > + for (gpa = start; gpa > 0; gpa -= step) { > if (ucall_mmio_init(vm, gpa & ~(vm->page_size - 1))) > return; > } Ugh... sorry for this junk. I was obviously way too hasty "fixing" this. I forgot to consider that the virtual address space is most likely *not* a multiple of the calculated step. I'll send a v2 that doesn't suck in a moment. drew
On 29/11/18 16:29, Andrew Jones wrote: > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > tools/testing/selftests/kvm/lib/ucall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/lib/ucall.c b/tools/testing/selftests/kvm/lib/ucall.c > index 4777f9bb5194..e28bdd6b546c 100644 > --- a/tools/testing/selftests/kvm/lib/ucall.c > +++ b/tools/testing/selftests/kvm/lib/ucall.c > @@ -58,7 +58,7 @@ void ucall_init(struct kvm_vm *vm, ucall_type_t type, void *arg) > start = 1ul << (vm->va_bits * 2 / 3); > end = 1ul << vm->va_bits; > step = 1ul << (vm->va_bits / 6); > - for (gpa = start; gpa >= 0; gpa -= step) { > + for (gpa = start; gpa > 0; gpa -= step) { > if (ucall_mmio_init(vm, gpa & ~(vm->page_size - 1))) > return; > } > Queued, thanks. Paolo
diff --git a/tools/testing/selftests/kvm/lib/ucall.c b/tools/testing/selftests/kvm/lib/ucall.c index 4777f9bb5194..e28bdd6b546c 100644 --- a/tools/testing/selftests/kvm/lib/ucall.c +++ b/tools/testing/selftests/kvm/lib/ucall.c @@ -58,7 +58,7 @@ void ucall_init(struct kvm_vm *vm, ucall_type_t type, void *arg) start = 1ul << (vm->va_bits * 2 / 3); end = 1ul << vm->va_bits; step = 1ul << (vm->va_bits / 6); - for (gpa = start; gpa >= 0; gpa -= step) { + for (gpa = start; gpa > 0; gpa -= step) { if (ucall_mmio_init(vm, gpa & ~(vm->page_size - 1))) return; }
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Jones <drjones@redhat.com> --- tools/testing/selftests/kvm/lib/ucall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)