Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3512466pxb; Mon, 24 Jan 2022 11:06:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyD4ZTN7n0HPsjcFD2trxAKwHT+RlhZ2OpGLLEGYS795CfP24ljQRUtfGBVo/qKuoIyIv71 X-Received: by 2002:a17:902:c944:b0:14b:4a68:8ce2 with SMTP id i4-20020a170902c94400b0014b4a688ce2mr6714449pla.87.1643051211030; Mon, 24 Jan 2022 11:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643051211; cv=none; d=google.com; s=arc-20160816; b=kNq/8v87x9SkquOlervXgYgjBA56B5hIR9dcTxyNbcHNM3hM4LYQq0GcRs/j+sWNOM cWYyqoHwkqh4nOgN0XIdoF+oPmjgubHryGP33GZwkyei//Mbctx6UI/DFUtlWbagUjQP TA/Ft1ATmeejqoyA3TDPQ3/+eagdDA3Juib9gInPEwGeGzfTMT2TBlhg4mqyLkzvYS1K C6ihDr8whpu8ynKuEQAkm1bYEJfMMlxQunBxYtvDAWgrFMAz8X4QcQaFhvKPUUptUZwy dFuk90/gpdd1OXZDbyhEW61KSYEre7X/2ZKS8LuNE6PpivxZfdLYspVqxZIASxy11ZKw 0UDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IPFbfrHJ6YrXapqN6K+le3Ltd/e6LaT+IHt+F0E8NmE=; b=nw+xwX0H9eQ7HAyM3uCkBcz15DL6qmZxukNHMmO3ont2AJYiqPh8QKQ5pBYhKaEr/n 0XHIqebYfMoocpCYPbsdt9Fe0SOK9pu+jvJGHcGz0Y4QxkAuVe1Jgai8rMyb1ZNLhw7j zUmr1AevfpkjbtwB3qKDnEJIvbLqpgd/i6yzFbla0pNQEZhm3gKGQ1tZsixNq/YDxu4G mLOuQ3rldvFS9hqGSW+ellgHIhrJvfLOwHn540tsTq+Y97XIDE7UqrlTjv5cRKie0ZBL Tm6eOu1ukKdlpzdRgBWK3hxPHLH6AcOm0F6o2KFyHIEwLND80HofuGWqhumuw5Rk7jXl hMGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qJ+dcUMb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 10si14396345pgc.813.2022.01.24.11.06.35; Mon, 24 Jan 2022 11:06:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qJ+dcUMb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238007AbiAXLzN (ORCPT + 99 others); Mon, 24 Jan 2022 06:55:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiAXLzI (ORCPT ); Mon, 24 Jan 2022 06:55:08 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F7E3C06173B for ; Mon, 24 Jan 2022 03:55:08 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id f17so13089373wrx.1 for ; Mon, 24 Jan 2022 03:55:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IPFbfrHJ6YrXapqN6K+le3Ltd/e6LaT+IHt+F0E8NmE=; b=qJ+dcUMbd6zqqDcRVuIf2EzIHMBdWtsgv0Yso0AiNQkIbV5IUPQOAV9dJY19FXq0cG FOUk24NOyTdb5c7Of+bfsr+LAQ9ZFZo7xULqrKSryYBobwOw+Gp25HwmLeHFy6r6vZ2n h0Xr6OgIMob8SVm9IHIjUg+dFqtEjSL0ctSzRi7JPOaa/8d+kZxCBm24xwoAtnEl73+K QMIp17ggV/oTnByqlJdZxNoMR4302aWnDnrE55o5omgGwUgSIbO9v5MAOWIQtDXx553q lGr4NIHI2lyIEZuHB9IPghxeOUZhi8uFtD/y/Ey3yrDg08R4cgy8GPdaM+3zK9Unjezy +tZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IPFbfrHJ6YrXapqN6K+le3Ltd/e6LaT+IHt+F0E8NmE=; b=otZg+C84ZyGAL5canrheDFL2U0fXwLpGy+0b8b4KEddXR0Sa3r4mrZP2E0tJSu7c3X /ukqrhsQICu3XZpTq9f3Con+RcFKIYdXurT3v4qXHYxGmGZMskUIHBGpQhq884Z2a7dQ Zys2qqnXdvjUZRjDMlD6zkkwdpX+b2NamzSS7gM6FN1Xel1RvjDMpTHRJvARuggvWt43 Qgd7rOh2qu1dVGhmlMQMJwRtYkJ12zD1TwSLnhMNXWD1+MlptXes9gMie/QDUeSbQdoc X+X0BvpyOgzLqa0+SKsSOXnM8dUuna6lzQju52KVrLleV8UshDM38pobk0WxmdjHqhYq HOKg== X-Gm-Message-State: AOAM532ZtPod9s+UkI18dB/pf4wgZgjj+Ajz+ULi8tI5Gn1F/yrglm2N sFuD7D41DT5rNsfAtmnUpUgE0cvTJAFJkJi8i5c9gAC4zGc= X-Received: by 2002:adf:c843:: with SMTP id e3mr14327737wrh.38.1643025306645; Mon, 24 Jan 2022 03:55:06 -0800 (PST) MIME-Version: 1.0 References: <20220120074232.1084967-1-jens.wiklander@linaro.org> In-Reply-To: From: Jens Wiklander Date: Mon, 24 Jan 2022 12:54:56 +0100 Message-ID: Subject: Re: [PATCH v2] optee: add error checks in optee_ffa_do_call_with_arg() To: Sumit Garg Cc: linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, David Laight Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 20, 2022 at 12:18 PM Sumit Garg wrote: > > On Thu, 20 Jan 2022 at 13:12, Jens Wiklander wrote: > > > > Adds error checking in optee_ffa_do_call_with_arg() for correctness. > > > > Fixes: 4615e5a34b95 ("optee: add FF-A support") > > Signed-off-by: Jens Wiklander > > --- > > drivers/tee/optee/ffa_abi.c | 15 ++++++++++++--- > > 1 file changed, 12 insertions(+), 3 deletions(-) > > > > Reviewed-by: Sumit Garg I'm picking up this. Thanks, Jens > > -Sumit > > > diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c > > index 20a1b1a3d965..0775759a29c0 100644 > > --- a/drivers/tee/optee/ffa_abi.c > > +++ b/drivers/tee/optee/ffa_abi.c > > @@ -619,9 +619,18 @@ static int optee_ffa_do_call_with_arg(struct tee_context *ctx, > > .data2 = (u32)(shm->sec_world_id >> 32), > > .data3 = shm->offset, > > }; > > - struct optee_msg_arg *arg = tee_shm_get_va(shm, 0); > > - unsigned int rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params); > > - struct optee_msg_arg *rpc_arg = tee_shm_get_va(shm, rpc_arg_offs); > > + struct optee_msg_arg *arg; > > + unsigned int rpc_arg_offs; > > + struct optee_msg_arg *rpc_arg; > > + > > + arg = tee_shm_get_va(shm, 0); > > + if (IS_ERR(arg)) > > + return PTR_ERR(arg); > > + > > + rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params); > > + rpc_arg = tee_shm_get_va(shm, rpc_arg_offs); > > + if (IS_ERR(rpc_arg)) > > + return PTR_ERR(rpc_arg); > > > > return optee_ffa_yielding_call(ctx, &data, rpc_arg); > > } > > -- > > 2.31.1 > >