Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932385AbbEVH7Y (ORCPT ); Fri, 22 May 2015 03:59:24 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:23152 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932345AbbEVH7V (ORCPT ); Fri, 22 May 2015 03:59:21 -0400 Date: Fri, 22 May 2015 10:59:01 +0300 From: Dan Carpenter To: Dmitry Kalinkin Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Martyn Welch , Greg Kroah-Hartman , Manohar Vanga , Igor Alekseev Subject: Re: [PATCH 6/6] staging: vme_user: provide DMA functionality Message-ID: <20150522075901.GU22558@mwanda> References: <1431975393-19735-1-git-send-email-dmitry.kalinkin@gmail.com> <1431975393-19735-7-git-send-email-dmitry.kalinkin@gmail.com> <20150519091846.GB4150@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1529 Lines: 32 On Fri, May 22, 2015 at 01:12:19AM +0300, Dmitry Kalinkin wrote: > On Tue, May 19, 2015 at 12:18 PM, Dan Carpenter 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/