<pre>
Hi, Mac:

On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@mediatek.com>
> ---

[snip]

> +static int dp_tee_op_send(struct dp_tee_private *dp_tee_priv, u8
> *buf, size_t len, u32 cmd_id)
> +{
> +int rc;
> +u8 *temp_buf;
> +struct tee_ioctl_invoke_arg transceive_args;
> +struct tee_param command_params[4];
> +struct tee_shm *shm = dp_tee_priv->shm;
> +
> +if (len > MAX_COMMAND_SIZE) {
> +TLCERR("%s: len=%zd exceeds MAX_COMMAND_SIZE supported
> by dp TA\n", __func__, len);
> +return -EIO;
> +}
> +
> +memset(&transceive_args, 0, sizeof(transceive_args));
> +memset(command_params, 0, sizeof(command_params));
> +dp_tee_priv->resp_len = 0;
> +
> +/* Invoke FTPM_OPTEE_TA_SUBMIT_COMMAND function of dp TA */
> +transceive_args = (struct tee_ioctl_invoke_arg) {
> +.func = cmd_id,
> +.session = dp_tee_priv->session,
> +.num_params = 4,
> +};
> +
> +/* Fill FTPM_OPTEE_TA_SUBMIT_COMMAND parameters */
> +command_params[0] = (struct tee_param) {
> +.attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT,
> +.u.memref = {
> +.shm = shm,
> +.size = len,
> +.shm_offs = 0,
> +},
> +};
> +
> +temp_buf = tee_shm_get_va(shm, 0);
> +if (IS_ERR(temp_buf)) {
> +TLCERR("%s: tee_shm_get_va failed for transmit\n",
> __func__);
> +return PTR_ERR(temp_buf);
> +}
> +
> +memcpy(temp_buf, buf, len);

temp_buf is equal to buf, so drop temp_buf.

Regards,
CK

> +
> +command_params[1] = (struct tee_param) {
> +.attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT,
> +.u.memref = {
> +.shm = shm,
> +.size = MAX_RESPONSE_SIZE,
> +.shm_offs = MAX_COMMAND_SIZE,
> +},
> +};
> +
> +rc = tee_client_invoke_func(dp_tee_priv->ctx, &transceive_args,
> + command_params);
> +if (rc < 0 || transceive_args.ret != 0) {
> +TLCERR("%s: invoke error: 0x%x\n", __func__,
> transceive_args.ret);
> +return (rc < 0) ? rc : transceive_args.ret;
> +}
> +
> +temp_buf = tee_shm_get_va(shm,
> command_params[1].u.memref.shm_offs);
> +if (IS_ERR(temp_buf)) {
> +TLCERR("%s: tee_shm_get_va failed for receive\n",
> __func__);
> +return PTR_ERR(temp_buf);
> +}
> +
> +/* Sanity checks look good, cache the response */
> +memcpy(dp_tee_priv->resp_buf, temp_buf, MAX_RESPONSE_SIZE / 2);
> +dp_tee_priv->resp_len = MAX_RESPONSE_SIZE / 2;
> +
> +return 0;
> +}
> +

</pre><!--type:text--><!--{--><pre>************* MEDIATEK Confidentiality Notice ********************
The information contained in this e-mail message (including any 
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be 
conveyed only to the designated recipient(s). Any use, dissemination, 
distribution, printing, retaining or copying of this e-mail (including its 
attachments) by unintended recipient(s) is strictly prohibited and may 
be unlawful. If you are not an intended recipient of this e-mail, or believe 
that you have received this e-mail in error, please notify the sender 
immediately (by replying to this e-mail), delete any and all copies of 
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!
</pre><!--}-->