Skip to content

Commit 3382576

Browse files
karstengrdavem330
authored andcommitted
net/smc: fix structure size
The struct smc_cdc_msg must be defined as packed so the size is 44 bytes. And change the structure size check so sizeof is checked. Signed-off-by: Karsten Graul <[email protected]> Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 51dce24 commit 3382576

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

net/smc/smc_cdc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static inline void smc_cdc_add_pending_send(struct smc_connection *conn,
8282
sizeof(struct smc_cdc_msg) > SMC_WR_BUF_SIZE,
8383
"must increase SMC_WR_BUF_SIZE to at least sizeof(struct smc_cdc_msg)");
8484
BUILD_BUG_ON_MSG(
85-
offsetof(struct smc_cdc_msg, reserved) > SMC_WR_TX_SIZE,
85+
sizeof(struct smc_cdc_msg) != SMC_WR_TX_SIZE,
8686
"must adapt SMC_WR_TX_SIZE to sizeof(struct smc_cdc_msg); if not all smc_wr upper layer protocols use the same message size any more, must start to set link->wr_tx_sges[i].length on each individual smc_wr_tx_send()");
8787
BUILD_BUG_ON_MSG(
8888
sizeof(struct smc_cdc_tx_pend) > SMC_WR_TX_PEND_PRIV_SIZE,

net/smc/smc_cdc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct smc_cdc_msg {
4848
struct smc_cdc_producer_flags prod_flags;
4949
struct smc_cdc_conn_state_flags conn_state_flags;
5050
u8 reserved[18];
51-
} __aligned(8);
51+
} __packed; /* format defined in RFC7609 */
5252

5353
static inline bool smc_cdc_rxed_any_close(struct smc_connection *conn)
5454
{

0 commit comments

Comments
 (0)