Skip to content

Commit

Permalink
[sonic-swss] ARMHF warning fixes (#1325)
Browse files Browse the repository at this point in the history
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 <arheneus@marvell.com>
  • Loading branch information
antony-rheneus authored Jul 3, 2020
1 parent 10ad70c commit 2ebd44e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions mclagsyncd/mclaglink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<mclag_sub_option_hdr_t *>(static_cast<void *>(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<mclag_sub_option_hdr_t *>(static_cast<void *>(cur));
cur = cur + MCLAG_SUB_OPTION_HDR_LEN;
isolate_dst_port.insert(0, (const char*)cur, op_hdr->op_len);

Expand Down Expand Up @@ -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<mclag_sub_option_hdr_t *>(static_cast<void *>(cur));
if (op_hdr->op_type == MCLAG_SUB_OPTION_TYPE_MAC_LEARN_ENABLE)
{
learn_mode = "hardware";
Expand Down Expand Up @@ -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<mclag_sub_option_hdr_t *>(static_cast<void *>(cur));
cur = cur + MCLAG_SUB_OPTION_HDR_LEN;
port.insert(0, (const char*)cur, op_hdr->op_len);

Expand All @@ -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<mclag_sub_option_hdr_t *>(static_cast<void *>(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<mclag_sub_option_hdr_t *>(static_cast<void *>(cur));
cur = cur + MCLAG_SUB_OPTION_HDR_LEN;
mac_value.insert(0, (const char*)cur, op_hdr->op_len);

Expand Down Expand Up @@ -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<struct mclag_fdb_info *>(static_cast<void *>(cur + index * sizeof(struct mclag_fdb_info)));

fdb.mac = fdb_info->mac;
fdb.port_name = fdb_info->port_name;
Expand Down Expand Up @@ -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<mclag_msg_hdr_t *>(static_cast<void *>(infor_start));
msg_head->version = 1;
msg_head->msg_len = (unsigned short)infor_len;
msg_head->msg_type = MCLAG_SYNCD_MSG_TYPE_FDB_OPERATION;
Expand Down Expand Up @@ -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<mclag_msg_hdr_t *>(static_cast<void *>(infor_start));
msg_head->version = 1;
msg_head->msg_len = (unsigned short)infor_len;
msg_head->msg_type = MCLAG_SYNCD_MSG_TYPE_FDB_OPERATION;
Expand Down Expand Up @@ -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<mclag_msg_hdr_t *>(static_cast<void *>(infor_start));
msg_head->version = 1;
msg_head->msg_len = (unsigned short)infor_len;
msg_head->msg_type = MCLAG_SYNCD_MSG_TYPE_FDB_OPERATION;
Expand Down Expand Up @@ -676,7 +676,7 @@ uint64_t MclagLink::readData()

while (true)
{
hdr = (mclag_msg_hdr_t *)(m_messageBuffer + start);
hdr = reinterpret_cast<mclag_msg_hdr_t *>(static_cast<void *>(m_messageBuffer + start));
left = m_pos - start;
if (left < MCLAG_MSG_HDR_LEN)
break;
Expand Down

0 comments on commit 2ebd44e

Please sign in to comment.