Re: [PATCH] drm/nouveau: fix several DMA buffer leaks

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

 



On Fri, 2 Feb 2024 at 07:33, Timur Tabi <ttabi@xxxxxxxxxx> wrote:
>
> On Thu, 2024-02-01 at 13:55 -0600, Timur Tabi wrote:
> > +static void
> > +nvkm_gsp_mem_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_mem *mem)
> > +{
> > +       if (mem->data) {
> > +               dma_free_coherent(gsp->subdev.device->dev, mem->size, mem-
> > >data, mem->addr);
> > +               mem->data = NULL;
> > +               mem->addr = 0;
> > +       }
> > +}
>
> Dave, what do you think about doing this:
>
> if (mem->data) {
>
>         memset(mem->data, 0, mem->size);   <-------
>
>         dma_free_coherent(gsp->subdev.device->dev, mem->size,
> mem->data, mem->addr);
>         mem->data = NULL;
>         mem->addr = 0;
> }
>
> This would help situations where a buffer is access by GSP-RM after we think
> it's safe to free it.

I'd prefer to fill it with a posion value than 0

Dave.



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux