Re: [PATCH 1/3] arch/x86: Use offsetof

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pavel Machek wrote:

diff -u -p a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
--- a/arch/x86/kernel/vm86_32.c	2007-10-22 11:25:00.000000000 +0200
+++ b/arch/x86/kernel/vm86_32.c	2007-12-26 16:27:15.000000000 +0100
@@ -215,7 +215,9 @@ asmlinkage int sys_vm86old(struct pt_reg
 	ret = -EFAULT;
 	if (tmp)
 		goto out;
-	memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus);
+	memset(&info.vm86plus, 0,
+	       offsetof(struct kernel_vm86_struct, regs32) -
+	       offsetof(struct kernel_vm86_struct, vm86plus));

I do not think this makes it more readable... (int) -> (char *) would
make it portable and readable, AFAICT.
								Pavel

The right way to do it is:

	memset(&info.vm86plus, 0, sizeof info.vm86plus);

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

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux