net/smc: use a constant for control message length
authorKarsten Graul <kgraul@linux.vnet.ibm.com>
Wed, 28 Feb 2018 11:44:07 +0000 (12:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Feb 2018 17:30:25 +0000 (12:30 -0500)
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: Karsten Graul <kgraul@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_cdc.c
net/smc/smc_core.c

index 3cd086e5bd28c10eff887d94b51358757db094be..b42395d24cba50b0e30c39ab6275cdaa1eca3235 100644 (file)
@@ -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))
                return; /* short message */
-       if (cdc->len != sizeof(*cdc))
+       if (cdc->len != SMC_WR_TX_SIZE)
                return; /* invalid message */
        smc_cdc_msg_recv(cdc, link, wc->wr_id);
 }
index 2424c7100aaf63cf19e9d63aaa110f25c6aefe3a..053f0e66bec70fce6ab7f912eb5949457a9e62f3 100644 (file)
@@ -465,7 +465,7 @@ create:
                rc = smc_link_determine_gid(conn->lgr);
        }
        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
        spin_lock_init(&conn->acurs_lock);
 #endif