[Mesa-dev] [PATCH 3/6] si_pipe: do not dereference sscreen before checking if it is NULL.

Marek Olšák maraeo at gmail.com
Mon Mar 20 16:13:56 UTC 2017


On Mon, Mar 20, 2017 at 5:11 PM, Julien Isorce <julien.isorce at gmail.com> wrote:
> Should I remove
> https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/radeonsi/si_pipe.c#n687
> then ?  (if (!sscreen)  return;)

Yeah, that can be removed.

Marek

>
> On 20 March 2017 at 15:29, Marek Olšák <maraeo at gmail.com> wrote:
>>
>> NAK. sscreen is never NULL here.
>>
>> Marek
>>
>> On Thu, Mar 16, 2017 at 3:25 PM, Julien Isorce <julien.isorce at gmail.com>
>> wrote:
>> > CID 1354483
>> >
>> > Signed-off-by: Julien Isorce <jisorce at oblong.com>
>> > ---
>> >  src/gallium/drivers/radeonsi/si_pipe.c | 12 ++++++------
>> >  1 file changed, 6 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/src/gallium/drivers/radeonsi/si_pipe.c
>> > b/src/gallium/drivers/radeonsi/si_pipe.c
>> > index a9a7c8f..6cbaa72 100644
>> > --- a/src/gallium/drivers/radeonsi/si_pipe.c
>> > +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>> > @@ -675,12 +675,12 @@ static void si_destroy_screen(struct pipe_screen*
>> > pscreen)
>> >  {
>> >         struct si_screen *sscreen = (struct si_screen *)pscreen;
>> >         struct si_shader_part *parts[] = {
>> > -               sscreen->vs_prologs,
>> > -               sscreen->vs_epilogs,
>> > -               sscreen->tcs_epilogs,
>> > -               sscreen->gs_prologs,
>> > -               sscreen->ps_prologs,
>> > -               sscreen->ps_epilogs
>> > +               sscreen ? sscreen->vs_prologs : NULL,
>> > +               sscreen ? sscreen->vs_epilogs : NULL,
>> > +               sscreen ? sscreen->tcs_epilogs : NULL,
>> > +               sscreen ? sscreen->gs_prologs : NULL,
>> > +               sscreen ? sscreen->ps_prologs : NULL,
>> > +               sscreen ? sscreen->ps_epilogs : NULL
>> >         };
>> >         unsigned i;
>> >
>> > --
>> > 2.7.4
>> >
>> > _______________________________________________
>> > mesa-dev mailing list
>> > mesa-dev at lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>


More information about the mesa-dev mailing list