From: Juergen Gross <jgross@suse.com>
To: Thomas Gleixner <tglx@linutronix.de>, peng.hao2@zte.com.cn
Cc: bp@alien8.de, dave.hansen@linux.intel.com, peterz@infradead.org,
luto@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/mm/mem_encrypt_identity : fix error useage to sizeof
Date: Tue, 15 Jan 2019 11:21:44 +0100 [thread overview]
Message-ID: <cc31816f-a4b1-b694-dcac-ac13f4442508@suse.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1901151109070.1865@nanos.tec.linutronix.de>
On 15/01/2019 11:13, Thomas Gleixner wrote:
> On Mon, 7 Jan 2019, peng.hao2@zte.com.cn wrote:
>
>>>> Fix error usage to sizeof. It should not use sizeof to pointer.
>>>
>>> .... because?
>>>
>>> The commit message needs to explain what the potential issue could be
>>> and why it doesn't matter in this case.
>> I see the definition of pte_t may be more than sizeof(unsigned long).
>> So I think sizeof(pte_t) is safer.
>
> What exactly is the difference between:
>
> pte_t *p;
>
> sizeof(*p)
>
> and
>
> sizeof(pte_t)
>
> and what is safer about the latter?
Please note that the current code is using sizeof(p) instead of sizeof(*p).
And this is really different for X86_32 PAE.
Juergen
>
> Answer: No difference and nothing is safer because it's exactly the same.
>
> In general we use sizeof(*p) simply because when the data type of p changes
> you don't have to update the code, it just works and stays correct.
>
> Thanks,
>
> tglx
>
next prev parent reply other threads:[~2019-01-15 10:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201901071946365174691@zte.com.cn>
2019-01-15 10:13 ` Thomas Gleixner
2019-01-15 10:21 ` Juergen Gross [this message]
2019-01-15 10:25 ` [PATCH] " Thomas Gleixner
2019-01-15 10:35 ` Juergen Gross
2019-01-15 10:35 ` Thomas Gleixner
2018-12-29 6:34 Peng Hao
2018-12-29 8:00 ` Borislav Petkov
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=cc31816f-a4b1-b694-dcac-ac13f4442508@suse.com \
--to=jgross@suse.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peng.hao2@zte.com.cn \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®