Message ID | 20210210214229.15595-1-michael@walle.cc |
---|---|
State | Accepted |
Commit | 8c02d842b61ebd579e42ff3f0326457e7d10ec95 |
Delegated to: | Michal Simek |
Headers | show |
Series | fpga: zynqpl: fix buffer alignment | expand |
On 2/10/21 10:42 PM, Michael Walle wrote: > Due to pointer arithmetic, "sizeof(u32) * ARCH_DMA_MINALIGN" is > subtracted. It seems that the original intention was to just subtract > ARCH_DMA_MINALIGN. Fix it. > > Signed-off-by: Michael Walle <michael@walle.cc> > --- > drivers/fpga/zynqpl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c > index a11e485525..2de40109a8 100644 > --- a/drivers/fpga/zynqpl.c > +++ b/drivers/fpga/zynqpl.c > @@ -315,7 +315,7 @@ static u32 *zynq_align_dma_buffer(u32 *buf, u32 len, u32 swap) > if (new_buf > buf) { > debug("%s: Aligned buffer is after buffer start\n", > __func__); > - new_buf -= ARCH_DMA_MINALIGN; > + new_buf = (u32 *)((u32)new_buf - ARCH_DMA_MINALIGN); > } > printf("%s: Align buffer at %x to %x(swap %d)\n", __func__, > (u32)buf, (u32)new_buf, swap); > applied. M
diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c index a11e485525..2de40109a8 100644 --- a/drivers/fpga/zynqpl.c +++ b/drivers/fpga/zynqpl.c @@ -315,7 +315,7 @@ static u32 *zynq_align_dma_buffer(u32 *buf, u32 len, u32 swap) if (new_buf > buf) { debug("%s: Aligned buffer is after buffer start\n", __func__); - new_buf -= ARCH_DMA_MINALIGN; + new_buf = (u32 *)((u32)new_buf - ARCH_DMA_MINALIGN); } printf("%s: Align buffer at %x to %x(swap %d)\n", __func__, (u32)buf, (u32)new_buf, swap);
Due to pointer arithmetic, "sizeof(u32) * ARCH_DMA_MINALIGN" is subtracted. It seems that the original intention was to just subtract ARCH_DMA_MINALIGN. Fix it. Signed-off-by: Michael Walle <michael@walle.cc> --- drivers/fpga/zynqpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)