On 26.07.2011, at 19:28, Vasiliy Kulikov wrote: > Alexander, > > On Tue, Jul 26, 2011 at 19:05 +0200, Alexander Graf wrote: >>> @@ -2623,6 +2626,7 @@ static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu, >>> dbgregs->dr6 = vcpu->arch.dr6; >>> dbgregs->dr7 = vcpu->arch.dr7; >>> dbgregs->flags = 0; >>> + memset(&dbgregs->reserved, 0, sizeof(dbgregs->reserved)); >>> } >>> >>> static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, >>> @@ -3106,6 +3110,7 @@ static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) >>> sizeof(ps->channels)); >>> ps->flags = kvm->arch.vpit->pit_state.flags; >>> mutex_unlock(&kvm->arch.vpit->pit_state.lock); >>> + memset(&ps->reserved, 0, sizeof(ps->reserved)); >> >> struct kvm_pit_state2 { >> struct kvm_pit_channel_state channels[3]; >> __u32 flags; >> __u32 reserved[9]; >> }; >> >> So memset(&ps->reserved) would give you the a __u32 **, no? Same goes for all the other array sets in here. Or am I understanding some C logic wrong? :) > > No, the array name and an address of the array give the same address. I > could use ps->reserved instead of &ps->reserved, but it is a question of > coding style. I got opposite opinions on this question from different > maintainers. > > Another thing is that sizeof() of the array name and the pointer to the > first array element differ. But I used sizeof(array) here, so it should > be correct. Yup, the sizeof looks fine. I was really only puzzled about the &array part. But if it's standardized to return the same as array, then that's great and I can call myself more educated now :) Alex -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html