Nouveau Archive mirror
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: Timur Tabi <ttabi@nvidia.com>
Cc: "airlied@redhat.com" <airlied@redhat.com>,
	 "nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>
Subject: Re: [PATCH] drm/nouveau: fix several DMA buffer leaks
Date: Fri, 2 Feb 2024 13:16:48 +1000	[thread overview]
Message-ID: <CAPM=9txV2cByuVZayeY=DJtWA4oZLj-aHFTssT3hP=y9h56zxw@mail.gmail.com> (raw)
In-Reply-To: <668e68a40a81d751682033684e049dda07ab049d.camel@nvidia.com>

On Fri, 2 Feb 2024 at 07:33, Timur Tabi <ttabi@nvidia.com> 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.

      reply	other threads:[~2024-02-02  3:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 19:55 [PATCH] drm/nouveau: fix several DMA buffer leaks Timur Tabi
2024-02-01 21:26 ` Timur Tabi
2024-02-02  3:16   ` Dave Airlie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPM=9txV2cByuVZayeY=DJtWA4oZLj-aHFTssT3hP=y9h56zxw@mail.gmail.com' \
    --to=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ttabi@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).