xiaoxiang781216 commented on code in PR #16309:
URL: https://github.com/apache/nuttx/pull/16309#discussion_r2077901273


##########
drivers/misc/optee.c:
##########
@@ -154,6 +202,245 @@ static bool optee_is_valid_range(FAR const void *va, 
size_t size)
 #  define optee_is_valid_range(addr, size) (true)
 #endif
 
+/****************************************************************************
+ * Name: optee_msg_alloc
+ *
+ * Description:
+ *   Allocate OP-TEE page-aligned memory for use as arguments to OP-TEE
+ *   calls, large enough to fit `num_params` parameters. Initialize the
+ *   buffer to 0, and set the `.num_params` field to the specified value.
+ *
+ *   Use `kmm_free()` to free the memory returned.
+ *
+ * Parameters:
+ *   priv       - the driver's private data structure
+ *   num_params - the number of arguments to allocate shared memory for.
+ *                Can be zero.
+ *
+ * Returned Values:
+ *   On success, pointer to OP-TEE message arguments struct initialized
+ *   to 0 except for `.num_params`, which is initialized to the specified.
+ *   On failure, NULL.
+ *
+ ****************************************************************************/
+
+static FAR struct optee_msg_arg *
+optee_msg_alloc(FAR struct optee_priv_data *priv, uint32_t num_params)
+{
+  FAR struct optee_msg_arg *msg;
+
+  if (priv->alignment)

Review Comment:
   alloca should always return the buffer align to the machine word at least, 
so it's should be `>` to switch to malloc



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to