diff mbox series

[03/10] mmc-utils: Pack rpmb_frame structure to avoid padding bytes

Message ID 20250407082833.108616-4-avri.altman@sandisk.com
State New
Headers show
Series mmc-utils: Secure Write Protect Mode Enhancements | expand

Commit Message

Avri Altman April 7, 2025, 8:28 a.m. UTC
From: Avri Altman <avri.altman@wdc.com>

This patch adds the __attribute__((packed)) attribute to the rpmb_frame
structure to ensure that it is packed without any padding bytes. This
guarantees that each field in the structure corresponds exactly to the
specified offsets, which is crucial for correct data interpretation and
communication with hardware.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
 mmc_cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mmc_cmds.c b/mmc_cmds.c
index 125816d..d53ed9c 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -2110,7 +2110,7 @@  struct rpmb_frame {
 	u_int16_t block_count;
 	u_int16_t result;
 	u_int16_t req_resp;
-};
+} __attribute__((packed));
 
 static inline void set_single_cmd(struct mmc_ioc_cmd *ioc, __u32 opcode,
 				  int write_flag, unsigned int blocks,