Re: [PATCH] kvm_s390_vm_start_migration: check dirty_bitmap before using it as target for memset()

From: Claudio Imbrenda
Date: Tue Sep 10 2019 - 06:21:25 EST


On Mon, 9 Sep 2019 18:21:47 +0200
Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote:

[...]


> > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> > index f329dcb3f44c..dfba51c9d60c 100644
> > --- a/arch/s390/kvm/kvm-s390.c
> > +++ b/arch/s390/kvm/kvm-s390.c
> > @@ -1018,6 +1018,10 @@ static int
> > kvm_s390_vm_start_migration(struct kvm *kvm) /* mark all the pages
> > in active slots as dirty */ for (slotnr = 0; slotnr <
> > slots->used_slots; slotnr++) { ms = slots->memslots + slotnr;
> > + if (!ms->dirty_bitmap) {
> > + WARN(1, "ms->dirty_bitmap == NULL\n");
>
> I would prefer to not have a WARN_ON. Otherwise this would allow a
> malicious user to spam the log.

I agree, the WARN is not needed.

>
> > + return -EINVAL;
> > + }
> > /*
> > * The second half of the bitmap is only used on
> > x86,
> > * and would be wasted otherwise, so we put it to
> > good

Otherwise it looks good.



Claudio Imbrenda