Re: [PATCH 6/6] staging: vme_user: provide DMA functionality

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

 



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@xxxxxxxxxx> 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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux