Re: [PATCH] nouveau: Do not leak in nv20_graph_create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 3 Jul 2011, Paul Menzel wrote:

> Dear Jesper,
> 
> 
> Am Sonntag, den 03.07.2011, 12:25 +0200 schrieb Jesper Juhl:
> > If we return due to an unknown chipset in 
> > drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the 
> > memory allocated to 'pgraph'.
> > 
> > This patch should fix the leak and it also disambiguates the "PGRAPH:
> > unknown chipset\n" error message - it's nice to be able to tell which
> > branch created the error which is impossible if the error messages are
> > 100% identical.
> > 
> > Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/nouveau/nv20_graph.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> >   Don't have the hardware, so compile tested only.
> > 
> > diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c
> > index affc7d7..059ad65 100644
> > --- a/drivers/gpu/drm/nouveau/nv20_graph.c
> > +++ b/drivers/gpu/drm/nouveau/nv20_graph.c
> > @@ -752,6 +752,7 @@ nv20_graph_create(struct drm_device *dev)
> >  			pgraph->grctx_user = 0x0000;
> >  			break;
> >  		default:
> > +			kfree(pgraph);
> >  			NV_ERROR(dev, "PGRAPH: unknown chipset\n");
> >  			return 0;
> >  		}
> > @@ -773,7 +774,8 @@ nv20_graph_create(struct drm_device *dev)
> >  			pgraph->grctx_size = NV35_36_GRCTX_SIZE;
> >  			break;
> >  		default:
> > -			NV_ERROR(dev, "PGRAPH: unknown chipset\n");
> > +			kfree(pgraph);
> > +			NV_ERROR(dev, "PGRAPH: unknown chipset.\n");
> 
> so the only disambiguation is the full stop at the end?
> 
Yeah. I guess I could have reworded the text, but I settled on just adding 
that "."...

-- 
Jesper Juhl <jj@xxxxxxxxxxxxx>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux