Skip to content

Commit 231cc29

Browse files
kartbenrlubos
authored andcommitted
[nrf fromtree] net: lib: ptp: fix memory slab alignment issues
Commit 3c47f91be4f879c9f1eac4c2be0a1bdd2de426ff introduced alignment validation in K_MEM_SLAB_DEFINE macros. A couple PTP message slabs wer using alignment 8, while the size of the elements wasn't a multiple of 8, causing a static assertion failure. Fix by changing the alignment from 8 to 4 bytes. Signed-off-by: Benjamin Cabé <[email protected]> (cherry picked from commit 222a601b21e41af101bc82df4f34c6b813fc0c6e) Signed-off-by: Robert Lubos <[email protected]>
1 parent e03ee7a commit 231cc29

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

subsys/net/lib/ptp/msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(ptp_msg, CONFIG_PTP_LOG_LEVEL);
1919

2020
static struct k_mem_slab msg_slab;
2121

22-
K_MEM_SLAB_DEFINE_STATIC(msg_slab, sizeof(struct ptp_msg), CONFIG_PTP_MSG_POLL_SIZE, 8);
22+
K_MEM_SLAB_DEFINE_STATIC(msg_slab, sizeof(struct ptp_msg), CONFIG_PTP_MSG_POLL_SIZE, 4);
2323

2424
static const char *msg_type_str(struct ptp_msg *msg)
2525
{

subsys/net/lib/ptp/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ BUILD_ASSERT(CONFIG_PTP_FOREIGN_TIME_TRANSMITTER_RECORD_SIZE >= 5 * CONFIG_PTP_N
3838
K_MEM_SLAB_DEFINE_STATIC(foreign_tts_slab,
3939
sizeof(struct ptp_foreign_tt_clock),
4040
CONFIG_PTP_FOREIGN_TIME_TRANSMITTER_RECORD_SIZE,
41-
8);
41+
4);
4242
#endif
4343

4444
char str_port_id[] = "FF:FF:FF:FF:FF:FF:FF:FF-FFFF";

0 commit comments

Comments
 (0)