[<prev] [next>] [day] [month] [year] [list]
Message-ID:
<AM9PR04MB86042908192F7C5C7E9B139395AF2@AM9PR04MB8604.eurprd04.prod.outlook.com>
Date: Wed, 2 Apr 2025 06:14:26 +0000
From: Pankaj Gupta <pankaj.gupta@....com>
To: Frank Li <frank.li@....com>
CC: Jonathan Corbet <corbet@....net>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Shawn Guo
<shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix
Kernel Team <kernel@...gutronix.de>, Fabio Estevam <festevam@...il.com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>
Subject: RE: [PATCH v14 4/6] firmware: imx: add driver for NXP EdgeLock
Enclave
>> diff --git a/drivers/firmware/imx/ele_common.c
...
>> + *
>> + * Return:
>> + * 0: if the input length is not 4 byte aligned, or num of words < 5.
>> + * chksum: calculated word by word.
>> + */
>> +u32 se_add_msg_chksum(u32 *msg, u32 msg_len) {
>> + u32 nb_words = msg_len / (u32)sizeof(u32);
>> + u32 chksum = 0;
>> + u32 i;
>> +
>> + if (nb_words < 5)
>> + return chksum;
For msg_length = 8 bytes or nb_words = 2, execution flow will never continue
after the above check.
>> +
>> + if (msg_len % SE_MSG_WORD_SZ) {
>> + pr_err("Msg-len is not 4-byte aligned.");
>> + return chksum;
>> + }
>> +
>> + for (i = 0; i < nb_words - 1; i++)
>> + chksum ^= *(msg + i);
> if msg_len is 8, nv_words is 2,
For msg_length = 8 bytes or nb_words = 2, execution flow will never here.
> Only first *(msg + 0) is calcucate, is it what your expected? If yes,
> need comments said why *(msg + 1) needn't calcuate.
Since msg_len also includes the 4 bytes (or 1word) to store the checksum
value. Hence, *(msg + 1) needn't be calcuated
Will add that as a comment.
>> +
>> + return chksum;
>> +}
>> +
>> +int ele_msg_rcv(struct se_if_priv *priv,
>> + struct se_clbk_handle *se_clbk_hdl) {
>> + int err = 0;
>> +
>> + do {
>> + err = wait_for_completion_interruptible(&se_clbk_hdl->done);
>> + if (err == -ERESTARTSYS) {
>> + if (priv->waiting_rsp_clbk_hdl.rx_msg) {
>> + priv->waiting_rsp_clbk_hdl.signal_rcvd =
true;
>> + continue;
> Is possible dead loop here?
No. it will be the same condition with or without continue.
- With using ctrl + c, in case of no response from FW, it will continue to
wait indefinitely. There will be no impact of using ctrl + c on this.
- Without using ctrl + c, in case of no response from FW, it will continue
to wait indefinitely,
So, this code leg was implemented to handle the scenario, where the FW is
always responsive and "ctrl + c", is pressed to stop an ongoing task.
It will gracefully exits after completing the full exchange.
>> + }
Download attachment "smime.p7s" of type "application/pkcs7-signature" (11094 bytes)
Powered by blists - more mailing lists