Re: NULL checks of deferenced pointers in picksplit method of intarray

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NULL checks of deferenced pointers in picksplit method of intarray
Date: 2015-02-16 23:36:09
Message-ID: CAB7nPqQJF_aSji_N5kPjwf2dLq63kWEL1E+nCVkePG1d8Mx4Ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 17, 2015 at 6:49 AM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>
>> Coverity is pointing out that _int_split.c has unnecessary checks
>> for deferenced pointers in 5 places.
>
>> Attached is a patch to adjust those things.
>
> Pushed. Thanks!

Thanks.

>> Also, as far as I understood from this code, no elements
>> manipulated are NULL, perhaps this is worth an assertion?
>
> I'm not clear where you were thinking of, but anyway that seemed
> like a separate patch if we're going to do it, so I went ahead with
> pushing the issued Coverity flagged. The arguments to the function
> don't need such a check because the function is exposed to SQL with
> the STRICT option (but you probably already knew that). While
> reviewing the safety of this patch the only place that I ran across
> that I felt maybe deserved an assertion was that n >= 0 near the
> top of copy_intArrayType(), but that seems marginal.

Yeah, we don't do that for the other STRICT functions, let's not do it then.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kouhei Kaigai 2015-02-16 23:50:22 Re: Commit fest 2015-12 enters money time
Previous Message Michael Paquier 2015-02-16 23:34:04 Re: Commit fest 2015-12 enters money time