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: <4EC9A136.7080004@oss.ntt.co.jp>
Date:	Mon, 21 Nov 2011 09:54:14 +0900
From:	Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>
To:	Avi Kivity <avi@...hat.com>
CC:	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>,
	Marcelo Tosatti <mtosatti@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH v2 3/6] KVM: introduce kvm_for_each_memslot macro

(2011/11/20 20:21), Avi Kivity wrote:
> On 11/18/2011 11:18 AM, Xiao Guangrong wrote:
>> index bb8728e..10524c0 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -307,6 +307,10 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
>>   	     (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
>>   	     idx++)
>>
>> +#define kvm_for_each_memslot(slots, memslot, i)	\
>> +	for (i = 0; i<  (slots)->nmemslots&&	\
>> +	      ({ memslot =&(slots)->memslots[i]; 1; }); i++)
>> +
>>
>
> Statement expression not needed, you can use the comma operator:
>
>    i<  (slots)->nmemslots&&  (memslot = @(slots)->memslots[i], true)
>
> or even
>
>    memslot =&(slots)->memslots[i], i<  (slots)->nmemslots
>
> or just kill i and make memslot the loop variable.
>

Do you have any preference for the arguments ordering?

I think placing the target one, memslot in this case, first is conventional in
the kernel code, except when we want to place "kvm" or something like that.

But in kvm code, there seems to be some difference.

	Takuya
--
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