linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	Martyn Welch <martyn.welch@ge.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Manohar Vanga <manohar.vanga@gmail.com>,
	Igor Alekseev <igor.alekseev@itep.ru>
Subject: Re: [PATCH 6/6] staging: vme_user: provide DMA functionality
Date: Fri, 22 May 2015 10:59:01 +0300	[thread overview]
Message-ID: <20150522075901.GU22558@mwanda> (raw)
In-Reply-To: <DCA609ED-9931-4020-8948-AE92D02C6820@gmail.com>

On Fri, May 22, 2015 at 01:12:19AM +0300, Dmitry Kalinkin wrote:
> On Tue, May 19, 2015 at 12:18 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > On Mon, May 18, 2015 at 09:56:33PM +0300, Dmitry Kalinkin wrote:
> >> 
> >> +     for_each_sg(sgt->sgl, sg, sg_count, i) {
> >> +             struct vme_dma_attr *pci_attr, *vme_attr, *dest, *src;
> >> +             dma_addr_t hw_address = sg_dma_address(sg);
> >> +             unsigned int hw_len = sg_dma_len(sg);
> >> +
> >> +             vme_attr = vme_dma_vme_attribute(dma_op->vme_addr + pos,
> >                                                 ^^^^^^^^^^^^^^^^^^^^^^
> > 
> > ->vme_addr comes from the user and we don't seem to have done any
> > validation that it's correct.  This addition can overflow.  How is this
> > safe?  (This is not a rhetorical question, I am a newbie in this).
> > 
> This expression calculates address on the VME bus, where we already have
> full access. There shouldn't have security implications. Such transfer will
> most likely wrap or cause DMA transfer error (gives EIO).

Ahh...   Thanks. Again I was just asking because I'm a bit of a newbie
here so there wasn't really a need to add the other check just to make
me happy.  But I do like the new check as well.

regards,
dan carpenter


      reply	other threads:[~2015-05-22  7:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18 18:56 [PATCH 0/6] vme: DMA improvements Dmitry Kalinkin
2015-05-18 18:56 ` [PATCH 1/6] Documentation: mention vme_master_mmap() in VME API Dmitry Kalinkin
2015-05-18 18:56 ` [PATCH 2/6] vme: tsi148: fix DMA lists longer that one item Dmitry Kalinkin
2015-05-18 18:56 ` [PATCH 3/6] vme: tsi148: fix first DMA item mapping Dmitry Kalinkin
2015-05-18 18:56 ` [PATCH 4/6] vme: stop DMA transfer on interruption Dmitry Kalinkin
2015-05-18 18:56 ` [PATCH 5/6] staging: vme_user: refactor llseek to switch(){} Dmitry Kalinkin
2015-05-18 18:56 ` [PATCH 6/6] staging: vme_user: provide DMA functionality Dmitry Kalinkin
2015-05-19  9:18   ` Dan Carpenter
2015-05-21 22:12     ` Dmitry Kalinkin
2015-05-22  7:59       ` 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=20150522075901.GU22558@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dmitry.kalinkin@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=igor.alekseev@itep.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manohar.vanga@gmail.com \
    --cc=martyn.welch@ge.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 NNTP newsgroup(s).