From: Julia Lawall <[EMAIL PROTECTED]> In the patch cc154ac64aa8d3396b187f64cef01ce67f433324, Al Viro observed that the proper way to compute the distance between two structure fields is to use offsetof() or a cast to a pointer to character. The same change can be applied to a few more files.
The change was made using the following semantic patch (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r@ type T; T s; type T1, T2; identifier fld1, fld2; typedef uint8_t; typedef u8; @@ ( (char *)&s.fld1 - (char *)&s.fld2 | (uint8_t *)&s.fld1 - (uint8_t *)&s.fld2 | (u8 *)&s.fld1 - (u8 *)&s.fld2 | - (T1)&s.fld1 - (T2)&s.fld2 + offsetof(T,fld1) - offsetof(T,fld2) ) // </smpl> Signed-off-by: Julia Lawall <[EMAIL PROTECTED]> --- 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)); info.regs32 = ®s; tsk->thread.vm86_info = v86; do_sys_vm86(&info, tsk); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/