Message ID | 20231204142156.1631060-1-ioana.ciornei@nxp.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] dpaa2-switch: fix size of the dma_unmap | expand |
Hi, On Mon, 2023-12-04 at 16:21 +0200, Ioana Ciornei wrote: > The size of the DMA unmap was wrongly put as a sizeof of a pointer. > Change the value of the DMA unmap to be the actual macro used for the > allocation and the DMA map. > > Fixes: 1110318d83e8 ("dpaa2-switch: add tc flower hardware offload on ingress traffic") > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > --- > drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c > index 4798fb7fe35d..609dfde0a64a 100644 > --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c > +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c > @@ -139,7 +139,8 @@ int dpaa2_switch_acl_entry_add(struct dpaa2_switch_filter_block *filter_block, > err = dpsw_acl_add_entry(ethsw->mc_io, 0, ethsw->dpsw_handle, > filter_block->acl_id, acl_entry_cfg); > > - dma_unmap_single(dev, acl_entry_cfg->key_iova, sizeof(cmd_buff), > + dma_unmap_single(dev, acl_entry_cfg->key_iova, > + DPAA2_ETHSW_PORT_ACL_CMD_BUF_SIZE, > DMA_TO_DEVICE); I see a similar unmap in dpaa2_switch_acl_entry_remove() that looks like being affect by the same issue. Why a similar change is not needed there? Thanks, Paolo
On Wed, Dec 06, 2023 at 12:04:17PM +0100, Paolo Abeni wrote: > Hi, > On Mon, 2023-12-04 at 16:21 +0200, Ioana Ciornei wrote: > > The size of the DMA unmap was wrongly put as a sizeof of a pointer. > > Change the value of the DMA unmap to be the actual macro used for the > > allocation and the DMA map. > > > > Fixes: 1110318d83e8 ("dpaa2-switch: add tc flower hardware offload on ingress traffic") > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > > --- > > drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c > > index 4798fb7fe35d..609dfde0a64a 100644 > > --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c > > +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c > > @@ -139,7 +139,8 @@ int dpaa2_switch_acl_entry_add(struct dpaa2_switch_filter_block *filter_block, > > err = dpsw_acl_add_entry(ethsw->mc_io, 0, ethsw->dpsw_handle, > > filter_block->acl_id, acl_entry_cfg); > > > > - dma_unmap_single(dev, acl_entry_cfg->key_iova, sizeof(cmd_buff), > > + dma_unmap_single(dev, acl_entry_cfg->key_iova, > > + DPAA2_ETHSW_PORT_ACL_CMD_BUF_SIZE, > > DMA_TO_DEVICE); > > I see a similar unmap in dpaa2_switch_acl_entry_remove() that looks > like being affect by the same issue. Why a similar change is not needed > there? > My bad, it's needed there also. Thanks! Ioana
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c index 4798fb7fe35d..609dfde0a64a 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c @@ -139,7 +139,8 @@ int dpaa2_switch_acl_entry_add(struct dpaa2_switch_filter_block *filter_block, err = dpsw_acl_add_entry(ethsw->mc_io, 0, ethsw->dpsw_handle, filter_block->acl_id, acl_entry_cfg); - dma_unmap_single(dev, acl_entry_cfg->key_iova, sizeof(cmd_buff), + dma_unmap_single(dev, acl_entry_cfg->key_iova, + DPAA2_ETHSW_PORT_ACL_CMD_BUF_SIZE, DMA_TO_DEVICE); if (err) { dev_err(dev, "dpsw_acl_add_entry() failed %d\n", err);
The size of the DMA unmap was wrongly put as a sizeof of a pointer. Change the value of the DMA unmap to be the actual macro used for the allocation and the DMA map. Fixes: 1110318d83e8 ("dpaa2-switch: add tc flower hardware offload on ingress traffic") Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> --- drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)