From 82c2ddbf1d1bf13109380e66699531ada0410f72 Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Tue, 9 Jan 2018 15:30:20 -0500 Subject: [PATCH] net/i40e/base: fix unaligned data issue This fix prevents errors or warnings while accessing unaligned 32-bit data words on non-x86 platforms during getting link info from firmware. Fixes: e8228f1a16b7 ("net/i40e/base: report supported link modes") Cc: stable@dpdk.org Signed-off-by: Qi Zhang Acked-by: Beilei Xing --- drivers/net/i40e/base/i40e_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index a0a1f84b6a..f3e34965fa 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -2025,7 +2025,11 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40e_hw *hw, if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR && hw->aq.api_min_ver >= 7) { - hw->phy.phy_types = LE32_TO_CPU(*(__le32 *)resp->link_type); + __le32 tmp; + + i40e_memcpy(&tmp, resp->link_type, sizeof(tmp), + I40E_NONDMA_TO_NONDMA); + hw->phy.phy_types = LE32_TO_CPU(tmp); hw->phy.phy_types |= ((u64)resp->link_type_ext << 32); } -- 2.20.1