[Mesa-dev] [PATCH v2 2/3] nvc0: check return value of nvc0_program_validate()
Pierre Moreau
pierre.morrow at free.fr
Mon Dec 14 08:59:02 PST 2015
On 11:56 AM - Dec 14 2015, Ilia Mirkin wrote:
> No, gp->code_size is set by the validation. You need to put that last.
IIRC, you can't assume in which order the compiler will decide to evaluate the
different expressions being AND'ed.
>
> On Mon, Dec 14, 2015 at 11:51 AM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
> > Spotted by Coverity.
> >
> > Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> > ---
> > src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
> > index 7e2e999..7c3d03e 100644
> > --- a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
> > +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
> > @@ -236,11 +236,8 @@ nvc0_gmtyprog_validate(struct nvc0_context *nvc0)
> > struct nouveau_pushbuf *push = nvc0->base.pushbuf;
> > struct nvc0_program *gp = nvc0->gmtyprog;
> >
> > - if (gp)
> > - nvc0_program_validate(nvc0, gp);
> > -
> > /* we allow GPs with no code for specifying stream output state only */
> > - if (gp && gp->code_size) {
> > + if (gp && gp->code_size && nvc0_program_validate(nvc0, gp)) {
> > const bool gp_selects_layer = !!(gp->hdr[13] & (1 << 9));
> >
> > BEGIN_NVC0(push, NVC0_3D(MACRO_GP_SELECT), 1);
> > --
> > 2.6.4
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list