All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: John Stultz <john.stultz@linaro.org>
Cc: "moderated list:DMA BUFFER SHARING FRAMEWORK"
	<linaro-mm-sig@lists.linaro.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [bug report] dma-buf: heaps: Add heap helpers
Date: Sat, 2 Nov 2019 11:45:28 +0300	[thread overview]
Message-ID: <20191102084528.GA21796@kadam> (raw)
In-Reply-To: <CALAqxLUtnZsw0q_5JFtyVjbnxeMUTND=Vt8XgS44iQ_n391XFQ@mail.gmail.com>

On Fri, Nov 01, 2019 at 12:31:53PM -0700, John Stultz wrote:
> On Thu, Oct 31, 2019 at 4:07 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > The patch 7b87ea704fd9: "dma-buf: heaps: Add heap helpers" from Oct
> > 21, 2019, leads to the following static checker warning:
> >
> >         drivers/dma-buf/heaps/heap-helpers.c:165 dma_heap_vm_fault()
> >         warn: uncapped user index 'buffer->pages[vmf->pgoff]'
> >
> > drivers/dma-buf/heaps/heap-helpers.c
> >    160  static vm_fault_t dma_heap_vm_fault(struct vm_fault *vmf)
> >    161  {
> >    162          struct vm_area_struct *vma = vmf->vma;
> >    163          struct heap_helper_buffer *buffer = vma->vm_private_data;
> >    164
> >    165          vmf->page = buffer->pages[vmf->pgoff];
> >                                           ^^^^^^^^^^
> > Smatch for some reason thinks this needs to be checked.  Smatch also
> > gets confused by these fault handlers and thinks there is some recursion
> > involved...
> 
> Hrm, I'm not totally sure I grok what it's looking for, but I'm
> guessing it's suggesting we check that pgoff isn't larger then the
> pagecount?
> I'll add that check in, but let me know if I've misunderstood.

Yeah, that's right.  Or maybe pgoff is checked somewhere else?

regards,
dan carpenter

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

      reply	other threads:[~2019-11-02  8:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 11:07 [bug report] dma-buf: heaps: Add heap helpers Dan Carpenter
2019-11-01 19:31 ` John Stultz
2019-11-02  8:45   ` Dan Carpenter [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=20191102084528.GA21796@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=john.stultz@linaro.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.