diff mbox series

[net] dpaa2-switch: fix size of the dma_unmap

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

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success SINGLE THREAD; Generated files up to date; no warnings/errors;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ioana Ciornei Dec. 4, 2023, 2:21 p.m. UTC
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(-)

Comments

Paolo Abeni Dec. 6, 2023, 11:04 a.m. UTC | #1
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
Ioana Ciornei Dec. 6, 2023, 12:39 p.m. UTC | #2
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 mbox series

Patch

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);