lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALAqxLU-qi6qQ=diMjN=XHfVcofhgQMj-kONRKkySODtnMqsWw@mail.gmail.com>
Date:   Thu, 21 Mar 2019 13:11:02 -0700
From:   John Stultz <john.stultz@...aro.org>
To:     Brian Starkey <Brian.Starkey@....com>
Cc:     lkml <linux-kernel@...r.kernel.org>,
        Laura Abbott <labbott@...hat.com>,
        Benjamin Gaignard <benjamin.gaignard@...aro.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        Sumit Semwal <sumit.semwal@...aro.org>,
        Liam Mark <lmark@...eaurora.org>,
        "Andrew F . Davis" <afd@...com>, Chenbo Feng <fengc@...gle.com>,
        Alistair Strachan <astrachan@...gle.com>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        nd <nd@....com>
Subject: Re: [RFC][PATCH 2/5 v2] dma-buf: heaps: Add heap helpers

On Tue, Mar 19, 2019 at 7:26 AM Brian Starkey <Brian.Starkey@....com> wrote:
>
> Hi John,
>
> On Tue, Mar 05, 2019 at 12:54:30PM -0800, John Stultz wrote:
>
> ...
>
> > +
> > +void dma_heap_buffer_destroy(struct dma_heap_buffer *heap_buffer)
> > +{
> > +     struct heap_helper_buffer *buffer = to_helper_buffer(heap_buffer);
> > +
> > +     if (buffer->kmap_cnt > 0) {
> > +             pr_warn_once("%s: buffer still mapped in the kernel\n",
> > +                          __func__);
>
> Could be worth something louder like a full WARN.
>
> > +             vunmap(buffer->vaddr);
> > +     }
> > +
> > +     buffer->free(buffer);
> > +}
> > +
>
> ...
>
> > +
> > +static void *dma_heap_dma_buf_kmap(struct dma_buf *dmabuf,
> > +                                     unsigned long offset)
> > +{
> > +     struct dma_heap_buffer *heap_buffer = dmabuf->priv;
> > +     struct heap_helper_buffer *buffer = to_helper_buffer(heap_buffer);
> > +
> > +     return buffer->vaddr + offset * PAGE_SIZE;
>
> I think it'd be good to check for NULL vaddr and return NULL in that
> case. Less chance of an invalid pointer being accidentally used then.

Thanks so much for the feedback! I've added these two suggestions in!
-john

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ