common/cnxk: fix unaligned access to device memory

Message ID 20220420063825.286183-1-psatheesh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series common/cnxk: fix unaligned access to device memory |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build fail github build: failed
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Satheesh Paul Antonysamy April 20, 2022, 6:38 a.m. UTC
  From: Satheesh Paul <psatheesh@marvell.com>

Use mbox_memcpy() instead of memcpy() to prevent unaligned access.

Fixes: 1f66919817e ("common/cnxk: improve MCAM entries management")
Cc: stable@dpdk.org

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 drivers/common/cnxk/roc_npc_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jerin Jacob May 3, 2022, 7:59 a.m. UTC | #1
On Wed, Apr 20, 2022 at 12:08 PM <psatheesh@marvell.com> wrote:
>
> From: Satheesh Paul <psatheesh@marvell.com>
>
> Use mbox_memcpy() instead of memcpy() to prevent unaligned access.
>
> Fixes: 1f66919817e ("common/cnxk: improve MCAM entries management")
> Cc: stable@dpdk.org
>
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks


> ---
>  drivers/common/cnxk/roc_npc_utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/common/cnxk/roc_npc_utils.c b/drivers/common/cnxk/roc_npc_utils.c
> index f9768ea3cf..0d02872c8b 100644
> --- a/drivers/common/cnxk/roc_npc_utils.c
> +++ b/drivers/common/cnxk/roc_npc_utils.c
> @@ -582,7 +582,7 @@ npc_allocate_mcam_entry(struct mbox *mbox, int prio,
>         if (!rsp_cmd->count)
>                 return -ENOSPC;
>
> -       memcpy(rsp_local, rsp_cmd, sizeof(*rsp));
> +       mbox_memcpy(rsp_local, rsp_cmd, sizeof(*rsp));
>
>         return 0;
>  }
> --
> 2.25.4
>
  

Patch

diff --git a/drivers/common/cnxk/roc_npc_utils.c b/drivers/common/cnxk/roc_npc_utils.c
index f9768ea3cf..0d02872c8b 100644
--- a/drivers/common/cnxk/roc_npc_utils.c
+++ b/drivers/common/cnxk/roc_npc_utils.c
@@ -582,7 +582,7 @@  npc_allocate_mcam_entry(struct mbox *mbox, int prio,
 	if (!rsp_cmd->count)
 		return -ENOSPC;
 
-	memcpy(rsp_local, rsp_cmd, sizeof(*rsp));
+	mbox_memcpy(rsp_local, rsp_cmd, sizeof(*rsp));
 
 	return 0;
 }