Re: Dereference before NULL check (src/backend/storage/ipc/latch.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Dereference before NULL check (src/backend/storage/ipc/latch.c)
Date: 2020-11-04 21:47:23
Message-ID: CAEudQAqkgqpw7fYRod_RzK5jLSY4SW7aPF_UWXQKueNV+gOy4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em ter., 3 de nov. de 2020 às 22:09, Kyotaro Horiguchi <
horikyota(dot)ntt(at)gmail(dot)com> escreveu:

> At Tue, 3 Nov 2020 20:44:23 +1300, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
> wrote in
> > On Tue, Nov 3, 2020 at 12:50 AM Kyotaro Horiguchi
> > <horikyota(dot)ntt(at)gmail(dot)com> wrote:
> > > With the fix patch, it changes to:
> > >
> > > [16632] LOG: FALSE LATCH: 0000000000000000
> >
> > Nice repo. But is it OK to not reset the Win32 event in this case?
> > Does it still work correctly if you wait on the latch after that
> > happened, and perhaps after the PG latch is reset?
>
> I'm not sure what is the point of the question, but the previous patch
> doesn't omit resetting the Win32-event in that case. In the same way
> with other implements of the same function, it resets the trigger that
> woke up the process since the trigger is no longer needed even if we
> are not waiting on it.
>
> If we call WaitLatch(OrSocket) that waits on the latch, it immediately
> returns because the latch is set. If we called ResetLatch before the
> next call to WaitLatch(), it correctly waits on a trigger to be
> pulled.
>
+1
The patch for me is syntactically equal to the code changed and
avoids the dereference.

regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2020-11-04 21:58:44 Re: Use of "long" in incremental sort code
Previous Message Tom Lane 2020-11-04 21:12:29 Re: Compatible defaults for LEAD/LAG