Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Karsten Graul and committed by
David S. Miller
cbba07a7 4e09ff53

+2 -2
+1 -1
net/smc/smc_cdc.c
··· 269 269 270 270 if (wc->byte_len < offsetof(struct smc_cdc_msg, reserved)) 271 271 return; /* short message */ 272 - if (cdc->len != sizeof(*cdc)) 272 + if (cdc->len != SMC_WR_TX_SIZE) 273 273 return; /* invalid message */ 274 274 smc_cdc_msg_recv(cdc, link, wc->wr_id); 275 275 }
+1 -1
net/smc/smc_core.c
··· 465 465 rc = smc_link_determine_gid(conn->lgr); 466 466 } 467 467 conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE; 468 - conn->local_tx_ctrl.len = sizeof(struct smc_cdc_msg); 468 + conn->local_tx_ctrl.len = SMC_WR_TX_SIZE; 469 469 #ifndef KERNEL_HAS_ATOMIC64 470 470 spin_lock_init(&conn->acurs_lock); 471 471 #endif