Skip to contentSkip to conversation

common/cnxk: fix unaligned access to device memory

PATCH Applied [email protected] 2 participants 2 messages Apr 20, 2022 – May 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/cnxk: fix unaligned access to device memory

From: Satheesh Paul <[email protected]>

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

Fixes 1f66919817e ("common/cnxk: improve MCAM entries management")
---
 drivers/common/cnxk/roc_npc_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/cnxk/roc_npc_utils.c +1 -1
index f9768ea3cf..0d02872c8b 100644
@@ -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;
 }
Signature · 1 line
2.25.4
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 9 lines · On Wed, Apr 20, 2022 at 12:08 PM <[email protected]> wrote:

From: Satheesh Paul <[email protected]>

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

Fixes 1f66919817e ("common/cnxk: improve MCAM entries management")

Applied to dpdk-next-net-mrvl/for-next-net. Thanks

Quoted 20 lines
---
 drivers/common/cnxk/roc_npc_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/cnxk/roc_npc_utils.c +1 -2
index f9768ea3cf..0d02872c8b 100644
@@ -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