Re: [PATCH] iommu/dma: Fix calculation overflow in __finalise_sg()

2019-07-25 Thread Nicolin Chen
Sorry to ping this but it's been a while. Robin, did you get a chance to resend your version? Thanks Nicolin On Tue, Jul 02, 2019 at 02:04:01PM -0700, Nicolin Chen wrote: > On Tue, Jul 02, 2019 at 11:40:02AM +0100, Robin Murphy wrote: > > On reflection, I don't really think that size_t fits here

Re: [PATCH] iommu/dma: Fix calculation overflow in __finalise_sg()

2019-07-02 Thread Nicolin Chen
On Tue, Jul 02, 2019 at 11:40:02AM +0100, Robin Murphy wrote: > On reflection, I don't really think that size_t fits here anyway, since > all the members of the incoming struct scatterlist are unsigned int too. > Does the patch below work? Yes. > ->8- > From: Robin Murphy > Subject: [PAT

Re: [PATCH] iommu/dma: Fix calculation overflow in __finalise_sg()

2019-07-02 Thread Robin Murphy
On 01/07/2019 22:50, Nicolin Chen wrote: > Hi Robin, > > On Mon, Jul 01, 2019 at 01:39:55PM +0100, Robin Murphy wrote: The max_len is a u32 type variable so the calculation on the left hand of the last if-condition will potentially overflow when a cur_len gets closer to UINT_MAX --

Re: [PATCH] iommu/dma: Fix calculation overflow in __finalise_sg()

2019-07-01 Thread Nicolin Chen
Hi Robin, On Mon, Jul 01, 2019 at 01:39:55PM +0100, Robin Murphy wrote: > > > The max_len is a u32 type variable so the calculation on the > > > left hand of the last if-condition will potentially overflow > > > when a cur_len gets closer to UINT_MAX -- note that there're > > > drivers setting max

Re: [PATCH] iommu/dma: Fix calculation overflow in __finalise_sg()

2019-07-01 Thread Robin Murphy
On 01/07/2019 13:21, Joerg Roedel wrote: On Fri, Jun 21, 2019 at 09:38:14PM -0700, Nicolin Chen wrote: The max_len is a u32 type variable so the calculation on the left hand of the last if-condition will potentially overflow when a cur_len gets closer to UINT_MAX -- note that there're drivers se

Re: [PATCH] iommu/dma: Fix calculation overflow in __finalise_sg()

2019-07-01 Thread Joerg Roedel
On Fri, Jun 21, 2019 at 09:38:14PM -0700, Nicolin Chen wrote: > The max_len is a u32 type variable so the calculation on the > left hand of the last if-condition will potentially overflow > when a cur_len gets closer to UINT_MAX -- note that there're > drivers setting max_seg_size to UINT_MAX: >

[PATCH] iommu/dma: Fix calculation overflow in __finalise_sg()

2019-06-21 Thread Nicolin Chen
The max_len is a u32 type variable so the calculation on the left hand of the last if-condition will potentially overflow when a cur_len gets closer to UINT_MAX -- note that there're drivers setting max_seg_size to UINT_MAX: drivers/dma/dw-edma/dw-edma-core.c:745: dma_set_max_seg_size(dma->de