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]
Date:	Thu, 24 Nov 2011 19:15:36 +0900
From:	Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>
To:	Xiao Guangrong <xiaoguangrong.eric@...il.com>
CC:	Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>,
	LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH v3 4/6] KVM: introduce id_to_memslot function

(2011/11/24 18:40), Xiao Guangrong wrote:

...

> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3521,7 +3521,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
>   	if (log->slot>= KVM_MEMORY_SLOTS)
>   		goto out;
>
> -	memslot =&kvm->memslots->memslots[log->slot];
> +	memslot = id_to_memslot(kvm->memslots, log->slot);
>   	r = -ENOENT;
>   	if (!memslot->dirty_bitmap)
>   		goto out;
> @@ -3544,15 +3544,16 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
>   		if (!slots)
>   			goto out;
>   		memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots));
> -		memslot =&slots->memslots[log->slot];
> -		memslot->dirty_bitmap = dirty_bitmap;
> +		memslot = id_to_memslot(slots, log->slot);
>   		memslot->nr_dirty_pages = 0;
> +		memslot->dirty_bitmap = dirty_bitmap;
>   		update_memslots(slots, NULL);
>
>   		old_slots = kvm->memslots;
>   		rcu_assign_pointer(kvm->memslots, slots);
>   		synchronize_srcu_expedited(&kvm->srcu);
> -		dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap;
> +		dirty_bitmap = id_to_memslot(old_slots,
> +					      log->slot)->dirty_bitmap;

You can eliminate this if you use old_slot and new_slot for the two memory slots.

	Takuya

>   		kfree(old_slots);
>
>   		write_protect_slot(kvm, memslot, dirty_bitmap, nr_dirty_pages);
--
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