From: "H. Peter Anvin" <hpa@zytor.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Julia Lawall <julia@diku.dk>,
tglx@linutronix.de, viro@ftp.linux.org.uk,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] arch/x86: Use offsetof
Date: Thu, 27 Dec 2007 01:01:38 +0000 [thread overview]
Message-ID: <4772F972.7070802@zytor.com> (raw)
In-Reply-To: <20071226194718.GB8844@elf.ucw.cz>
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
WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Julia Lawall <julia@diku.dk>,
tglx@linutronix.de, viro@ftp.linux.org.uk,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] arch/x86: Use offsetof
Date: Wed, 26 Dec 2007 17:01:38 -0800 [thread overview]
Message-ID: <4772F972.7070802@zytor.com> (raw)
In-Reply-To: <20071226194718.GB8844@elf.ucw.cz>
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
next prev parent reply other threads:[~2007-12-27 1:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-26 16:13 [PATCH 1/3] arch/x86: Use offsetof Julia Lawall
2007-12-26 16:13 ` Julia Lawall
2007-12-26 19:47 ` Pavel Machek
2007-12-26 19:47 ` Pavel Machek
2007-12-27 1:01 ` H. Peter Anvin [this message]
2007-12-27 1:01 ` H. Peter Anvin
2007-12-27 1:17 ` Al Viro
2007-12-27 1:21 ` H. Peter Anvin
2007-12-27 1:21 ` H. Peter Anvin
2007-12-30 13:54 ` Ingo Molnar
2007-12-30 13:54 ` Ingo Molnar
2007-12-27 1:44 ` Jan Engelhardt
2007-12-27 1:44 ` Jan Engelhardt
2007-12-27 1:49 ` H. Peter Anvin
2007-12-27 1:49 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4772F972.7070802@zytor.com \
--to=hpa@zytor.com \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=tglx@linutronix.de \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.