From: Thomas Gleixner <tglx@linutronix.de>
To: 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:13:26 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.21.1901151109070.1865@nanos.tec.linutronix.de> (raw)
In-Reply-To: <201901071946365174691@zte.com.cn>
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?
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 parent reply other threads:[~2019-01-15 10:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201901071946365174691@zte.com.cn>
2019-01-15 10:13 ` Thomas Gleixner [this message]
2019-01-15 10:21 ` [PATCH] " Juergen Gross
2019-01-15 10:25 ` Thomas Gleixner
2019-01-15 10:35 ` Juergen Gross
2019-01-15 10:35 ` Thomas Gleixner
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=alpine.DEB.2.21.1901151109070.1865@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--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=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®