From 2ebd44e062c8c85fff4dc02215c3b4aa869582a2 Mon Sep 17 00:00:00 2001 From: "arheneus@marvell.com" <51254330+antony-rheneus@users.noreply.github.com> Date: Fri, 3 Jul 2020 12:04:25 +0530 Subject: [PATCH] [sonic-swss] ARMHF warning fixes (#1325) Compiler Warnings : cast increases required alignment of target type [-Wcast-align] Fix: Use reintrepret cast to cast lower size pointer to bigger size pointer types Signed-off-by: Antony Rheneus --- mclagsyncd/mclaglink.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mclagsyncd/mclaglink.cpp b/mclagsyncd/mclaglink.cpp index da3a4347e455..857f95f410b7 100644 --- a/mclagsyncd/mclaglink.cpp +++ b/mclagsyncd/mclaglink.cpp @@ -197,14 +197,14 @@ void MclagLink::setPortIsolate(char *msg) cur = msg; /*get isolate src port infor*/ - op_hdr = (mclag_sub_option_hdr_t *)cur; + op_hdr = reinterpret_cast(static_cast(cur)); cur = cur + MCLAG_SUB_OPTION_HDR_LEN; isolate_src_port.insert(0, (const char*)cur, op_hdr->op_len); cur = cur + op_hdr->op_len; /*get isolate dst ports infor*/ - op_hdr = (mclag_sub_option_hdr_t *)cur; + op_hdr = reinterpret_cast(static_cast(cur)); cur = cur + MCLAG_SUB_OPTION_HDR_LEN; isolate_dst_port.insert(0, (const char*)cur, op_hdr->op_len); @@ -265,7 +265,7 @@ void MclagLink::setPortMacLearnMode(char *msg) cur = msg; /*get port learning mode info*/ - op_hdr = (mclag_sub_option_hdr_t *)cur; + op_hdr = reinterpret_cast(static_cast(cur)); if (op_hdr->op_type == MCLAG_SUB_OPTION_TYPE_MAC_LEARN_ENABLE) { learn_mode = "hardware"; @@ -319,7 +319,7 @@ void MclagLink::setFdbFlushByPort(char *msg) cur = msg; /*get port infor*/ - op_hdr = (mclag_sub_option_hdr_t *)cur; + op_hdr = reinterpret_cast(static_cast(cur)); cur = cur + MCLAG_SUB_OPTION_HDR_LEN; port.insert(0, (const char*)cur, op_hdr->op_len); @@ -340,14 +340,14 @@ void MclagLink::setIntfMac(char *msg) cur = msg; /*get intf key name*/ - op_hdr = (mclag_sub_option_hdr_t *)cur; + op_hdr = reinterpret_cast(static_cast(cur)); cur = cur + MCLAG_SUB_OPTION_HDR_LEN; intf_key.insert(0, (const char*)cur, op_hdr->op_len); cur = cur + op_hdr->op_len; /*get mac*/ - op_hdr = (mclag_sub_option_hdr_t *)cur; + op_hdr = reinterpret_cast(static_cast(cur)); cur = cur + MCLAG_SUB_OPTION_HDR_LEN; mac_value.insert(0, (const char*)cur, op_hdr->op_len); @@ -379,7 +379,7 @@ void MclagLink::setFdbEntry(char *msg, int msg_len) { memset(key, 0, 64); - fdb_info = (struct mclag_fdb_info *)(cur + index * sizeof(struct mclag_fdb_info)); + fdb_info = reinterpret_cast(static_cast(cur + index * sizeof(struct mclag_fdb_info))); fdb.mac = fdb_info->mac; fdb.port_name = fdb_info->port_name; @@ -502,7 +502,7 @@ ssize_t MclagLink::getFdbChange(char *msg_buf) { if (MCLAG_MAX_SEND_MSG_LEN - infor_len < sizeof(struct mclag_fdb_info)) { - msg_head = (mclag_msg_hdr_t *)infor_start; + msg_head = reinterpret_cast(static_cast(infor_start)); msg_head->version = 1; msg_head->msg_len = (unsigned short)infor_len; msg_head->msg_type = MCLAG_SYNCD_MSG_TYPE_FDB_OPERATION; @@ -535,7 +535,7 @@ ssize_t MclagLink::getFdbChange(char *msg_buf) { if (MCLAG_MAX_SEND_MSG_LEN - infor_len < sizeof(struct mclag_fdb_info)) { - msg_head = (mclag_msg_hdr_t *)infor_start; + msg_head = reinterpret_cast(static_cast(infor_start)); msg_head->version = 1; msg_head->msg_len = (unsigned short)infor_len; msg_head->msg_type = MCLAG_SYNCD_MSG_TYPE_FDB_OPERATION; @@ -567,7 +567,7 @@ ssize_t MclagLink::getFdbChange(char *msg_buf) if (infor_len <= sizeof(mclag_msg_hdr_t)) /*no fdb entry need notifying iccpd*/ return 1; - msg_head = (mclag_msg_hdr_t *)infor_start; + msg_head = reinterpret_cast(static_cast(infor_start)); msg_head->version = 1; msg_head->msg_len = (unsigned short)infor_len; msg_head->msg_type = MCLAG_SYNCD_MSG_TYPE_FDB_OPERATION; @@ -676,7 +676,7 @@ uint64_t MclagLink::readData() while (true) { - hdr = (mclag_msg_hdr_t *)(m_messageBuffer + start); + hdr = reinterpret_cast(static_cast(m_messageBuffer + start)); left = m_pos - start; if (left < MCLAG_MSG_HDR_LEN) break;