[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eef5d4c5-c2b4-47e4-bd29-3cd6faa39dc9@acm.org>
Date: Mon, 15 Sep 2025 14:54:21 -0700
From: Bart Van Assche <bvanassche@....org>
To: Bean Huo <beanhuo@...pp.de>, avri.altman@....com,
alim.akhtar@...sung.com, jejb@...ux.ibm.com, martin.petersen@...cle.com,
can.guo@....qualcomm.com, ulf.hansson@...aro.org, jens.wiklander@...aro.org
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
mikebi@...ron.com, lporzio@...ron.com, Bean Huo <beanhuo@...ron.com>
Subject: Re: [RFC PATCH v1 1/2] rpmb: move rpmb_frame struct and constants to
common header
On 9/15/25 2:46 PM, Bean Huo wrote:
> + * @stuff : stuff bytes
The above sounds vague to me ...
> +struct rpmb_frame {
> + u8 stuff[196];
> + u8 key_mac[32];
> + u8 data[256];
> + u8 nonce[16];
> + __be32 write_counter;
> + __be16 addr;
> + __be16 block_count;
> + __be16 result;
> + __be16 req_resp;
> +} __packed;
Applying __packed to a data structure in its entirety is a bad practice
because it prevents the compiler from generating optimal code for
accessing multi-byte members on architectures that do not support
unaligned accesses. Please only apply __packed to the members that need
it and consider checking the size of the data structure with
static_assert().
Thanks,
Bart.
Powered by blists - more mailing lists