[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF8kJuNFAaUj0rx=vWWZjNaKzDKj1J2-i-SJUhnZjd1KDtx0eg@mail.gmail.com>
Date: Mon, 20 Nov 2023 09:34:20 -0800
From: Chris Li <chrisl@...nel.org>
To: Kairui Song <ryncsn@...il.com>
Cc: Matthew Wilcox <willy@...radead.org>,
linux-mm <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"Huang, Ying" <ying.huang@...el.com>,
David Hildenbrand <david@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...e.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 01/24] mm/swap: fix a potential undefined behavior issue
Hi Kairui,
On Mon, Nov 20, 2023 at 3:15 AM Kairui Song <ryncsn@...il.com> wrote:
> > Chris
>
> Hi, Chris and Matthew.
>
> Thanks for the comments.
>
> Right, it's just a language syntax level thing, since "->" have a
> higher priority, so in the syntax level it is doing a member access
> first, then take the address. By C definition member access should
> not happen if the object is invalid (NULL). Only a hypothesis problem
> on paper...
The dereference only shows up in the abstract syntax tree level.
According to the C standard there are expansion and evaluation phases
after that. At the evaluation phase the dereference will turn into
pointer arithmetic. Per my understanding, the dereference never
actually happens, due to the evaluation rules, not even in theory.
> This is indeed not needed since in reality it's just pointer
> arithmetic. I'm OK dropping this.
Thanks
Chris
Powered by blists - more mailing lists