From: Qi Zhang Date: Tue, 9 Jan 2018 20:30:20 +0000 (-0500) Subject: net/i40e/base: fix unaligned data issue X-Git-Tag: spdx-start~444 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=82c2ddbf1d1bf13109380e66699531ada0410f72;p=dpdk.git 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 --- 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); }