[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1901151134340.1865@nanos.tec.linutronix.de>
Date: Tue, 15 Jan 2019 11:35:39 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Juergen Gross <jgross@...e.com>
cc: peng.hao2@....com.cn, bp@...en8.de, dave.hansen@...ux.intel.com,
peterz@...radead.org, luto@...nel.org, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/mm/mem_encrypt_identity : fix error useage to
sizeof
On Tue, 15 Jan 2019, Thomas Gleixner wrote:
> On Tue, 15 Jan 2019, Juergen Gross wrote:
> > On 15/01/2019 11:13, Thomas Gleixner wrote:
> > > On Mon, 7 Jan 2019, peng.hao2@....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).
>
> Ooops. That's wrong indeed, but we should not change it to sizeof(pte_t)
> and change it to sizeof(*p) instead.
Which is what the patch actually does. Just the above reply:
> > >> So I think sizeof(pte_t) is safer.
confused the hell out of me. -ENOTENOUGHCOFFEE
Powered by blists - more mailing lists