Commit cbba07a7 authored by Karsten Graul's avatar Karsten Graul Committed by David S. Miller

net/smc: use a constant for control message length

The sizeof(struct smc_cdc_msg) evaluates to 48 bytes instead of the
required 44 bytes. We need to use the constant value of
SMC_WR_TX_SIZE to set and check the control message length.
Signed-off-by: default avatarKarsten Graul <kgraul@linux.vnet.ibm.com>
Signed-off-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4e09ff53
...@@ -269,7 +269,7 @@ static void smc_cdc_rx_handler(struct ib_wc *wc, void *buf) ...@@ -269,7 +269,7 @@ static void smc_cdc_rx_handler(struct ib_wc *wc, void *buf)
if (wc->byte_len < offsetof(struct smc_cdc_msg, reserved)) if (wc->byte_len < offsetof(struct smc_cdc_msg, reserved))
return; /* short message */ return; /* short message */
if (cdc->len != sizeof(*cdc)) if (cdc->len != SMC_WR_TX_SIZE)
return; /* invalid message */ return; /* invalid message */
smc_cdc_msg_recv(cdc, link, wc->wr_id); smc_cdc_msg_recv(cdc, link, wc->wr_id);
} }
......
...@@ -465,7 +465,7 @@ int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr, ...@@ -465,7 +465,7 @@ int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr,
rc = smc_link_determine_gid(conn->lgr); rc = smc_link_determine_gid(conn->lgr);
} }
conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE; conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE;
conn->local_tx_ctrl.len = sizeof(struct smc_cdc_msg); conn->local_tx_ctrl.len = SMC_WR_TX_SIZE;
#ifndef KERNEL_HAS_ATOMIC64 #ifndef KERNEL_HAS_ATOMIC64
spin_lock_init(&conn->acurs_lock); spin_lock_init(&conn->acurs_lock);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment