From patchwork Mon Sep 9 18:38:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13797419 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACD95189517 for ; Mon, 9 Sep 2024 18:39:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725907158; cv=none; b=Vg/SHx/AoxXgs95p4wvdN30lTwKN3ji7quQAF4PHBvLlGBmur3yIZJFwIluJnB06JODOF5IdDbfVJKuMm59mP1GDL89hk9XtbHgu8X5QNYIXQr4ZSFx3ssQztsPHtX+2VqCAaWsMUfVkHLIWU2SvucaGujvw5hwCmsKjdOoJiec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725907158; c=relaxed/simple; bh=0qUNxtCzBlaQFlOv8wC73ChSYORwWKyGNipsDUBQlDs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pfirCbtiyRuekbjRAfwLua5OCcDvOxzuFPf3Ci3p/sEva+bHBL8XVSRzggiS+l7cndRu0EmtN0Yek7u8FCVtVH8clLzpnrxF1RgjFVe28sQhxwVdqdNDUTcKyOUSDhYP5oizYcBs/wQRm6nkTpZOfHIiOh7Q7yda2IM9Euhsn5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=CJBwD3kc; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="CJBwD3kc" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-374c7d14191so3177086f8f.0 for ; Mon, 09 Sep 2024 11:39:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1725907155; x=1726511955; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=68xIa0qDpH4oP2z5JZVL9mh4D3pN/G6kx+ceoOgqquI=; b=CJBwD3kcK4N4TQ50eiy3KSkeWMcadAhBaAsSLR1tysUgQSVTnc4Z+uzsws9VL0j7Y0 EYxauYA9u3qzwQjkVgqhMMSb0LMuKGap6rI35zip71ht/8qPJYXtwyFHxAi7L+1sjy9W su9/MbXxvqykQ6Y5BvwI2p0Fxlg9i5UIe+bJin7kQKKnyztpgm3M3OphI9Vyf32ReqLI Vs2WjnMnth0DG0Jq1FtQnUR2E2pHNZYt6iAPyZIWa4qP/OdKeIjj3oXLvJ9Hmm6BkVXU 63zkVPF3KNYSMVLxssyr2UTERJ1RRS3neqtrg61RdB5XgGGbpqeovGip67eLuvg6RnSj JRMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725907155; x=1726511955; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=68xIa0qDpH4oP2z5JZVL9mh4D3pN/G6kx+ceoOgqquI=; b=Ief7HFa2iEZTFBNbY0m97ZnMK3Oosv9lJw+fs0UZ3bDv1jGNCAZkfh3plsRiwAorWG 8khLuNtk7+nGZ+8g3Cf0RAw3NDCjFI2R+rYV0ToN4CEr6zu1TO7Ub8Um5Kpnfeh/ggAv CVOLOMfbLTbCtZqeK2fT7Ld5GXTn05ilnfNVrHlO7I3i4hbLrNOBl3M3f7zX6Jn/olhh gbMVTwpHdSXZuo6DSb/2h3VknL8ZnctcM0OuC1JCFULh/xUgc9i2l66HU3FCx180qaXy hOp+IFjyx+/BHRkDEgVuK2ajBRZnkP1et2SdRK+8BudUNFpKTpAn6fKDBaQhqd7efk2d PPXg== X-Gm-Message-State: AOJu0YxwZo/bVn8V8eloWQl7aqWJ53GLggbLwlZAZ7HxKihaz0A+zYN3 4RqQYCt/425JeZGZP5HV2NJySZsD8hggYaKcuXLRowvoynLqBJgYKZtYHEcSqHU= X-Google-Smtp-Source: AGHT+IE5jqNmt/6aHtknoFhxlFzamdBJRt3eKxTbcaC09W60hvq98OG7JbUdSuCh9TqgRh5Qq3Q+3Q== X-Received: by 2002:adf:fb52:0:b0:367:938f:550 with SMTP id ffacd0b85a97d-378a8a83f57mr258816f8f.25.1725907154179; Mon, 09 Sep 2024 11:39:14 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:9c15:247b:9be3:37a7]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956653b0sm6731721f8f.44.2024.09.09.11.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 11:39:13 -0700 (PDT) From: Bartosz Golaszewski Date: Mon, 09 Sep 2024 20:38:44 +0200 Subject: [PATCH 1/2] firmware: qcom: scm: fix a NULL-pointer dereference Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-tzmem-null-ptr-v1-1-96526c421bac@linaro.org> References: <20240909-tzmem-null-ptr-v1-0-96526c421bac@linaro.org> In-Reply-To: <20240909-tzmem-null-ptr-v1-0-96526c421bac@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Andrew Halaney , Elliot Berman , Dmitry Baryshkov , Rudraksha Gupta , "Linux regression tracking (Thorsten Leemhuis)" Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1059; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=nqlfwh7HALHLiMEbK03I1bZApCMOX4885VESmbJrqBM=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBm30DQijY7xHCLYVNTEsRX3YdkjVFExUq1B803T jML4T6UFKiJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZt9A0AAKCRARpy6gFHHX cpjDD/9YDlQ1lVYU2uLqRgkxsJkkNvrGIXhISuzPuSriq/JAlr4MhxGCjBVTJqGE5ji4NtM6xVq OdEB5JX/TIXG02EFTc0eu5scnLEW9QH1ktYU+wNCyaGMNVKHSGkTFIkMFL7t5FyXspWBSLrJlxu vgrdOf8wAtfoSTLbpv/0kIUr64XAxiGRLSZ8b5Ed0f0h8mytvuK8XSUm4DeHsy1FRn8I/5RwN19 IR737PPdqFIjRi+mMYTwNgX9uW5LzV3ziLr80+U1ZIHLx1/vhROU6pBXNoDoATp3lVFuc27WRe/ yKcYMT7IVwzOjY0xmDkBCF2qOOX1kDTJbkJSB8N/4bdSpj8JV/a2RzTPb9FjNJq2mBCQYAZ3QvB QSqEf1KJHFDPKInzI+MxGyPLyfTbVKYFHvJBHJ4zi9EvtnTRO10TYhTa3L6Jwx+D9qYiPIXfbhq Zhmjxh4dlJE6dJ6Y7WatuaKw1lVE1GemtZSMcvBlTvc6vh3pc46qhR+bkjaLKwUvaTe850dwPX0 ZX5uixIbHp/BwRqfHGJ+tYDPOn9PQWD3lIISXSV4BEM42EBYMi00HzE612cO+C1ZLLz3+YtL78+ dw+soHsU+agOKFogXQ+6fi8R7S1jivc1b6YYwNE1HEXXm2CczoUGGnCM9IsBmGri3CS64qCyIMb 4sbK7EuZvkOq8Rw== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Some SCM calls can be invoked with __scm being NULL (the driver may not have been and will not be probed as there's no SCM entry in device-tree). Make sure we don't dereference a NULL pointer. Fixes: 449d0d84bcd8 ("firmware: qcom: scm: smc: switch to using the SCM allocator") Reported-by: Rudraksha Gupta Closes: https://lore.kernel.org/lkml/692cfe9a-8c05-4ce4-813e-82b3f310019a@gmail.com/ Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio Tested-by: Rudraksha Gupta --- drivers/firmware/qcom/qcom_scm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 10986cb11ec0..8bac4915c211 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -216,7 +216,7 @@ static DEFINE_SPINLOCK(scm_query_lock); struct qcom_tzmem_pool *qcom_scm_get_tzmem_pool(void) { - return __scm->mempool; + return __scm ? __scm->mempool : NULL; } static enum qcom_scm_convention __get_convention(void) From patchwork Mon Sep 9 18:38:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13797420 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E3CC1891D1 for ; Mon, 9 Sep 2024 18:39:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725907159; cv=none; b=QmF/gtN6n/trV3/dkBMDAWfe765923ebnU586oX8ezPe31Qo3sbbz2tSzhhxC1earexLJ/PcYzjxYPKlhyJzA+VSR6jEY1YgitzhAqkmd8+Ol4deWSJhgSRV0cUdgPhwJTdSs9rdstDEcOmmQKL3GHFuBcxoLHr2HAB4kzKgJiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725907159; c=relaxed/simple; bh=4oSE+jnyWPvoY/e4qr9MxIJOiXeRnEt0PZyjDb42b0E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rHseac6OB/hllH0YIboTW82kgrDidLP1ZtAZcc9j80SGMy66yuuNpDOJAZcoXnnWrlDX8ib49KKj9OTUdrR2hDLNVDvTE54dq1J5eVU4MN0I9Xn3CI7o/DndghP+bBqvR6HiJ/RL4rakW5+DBHTRl60hGQMoGnopCUF66twuQMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=Wyc/9orw; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="Wyc/9orw" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-42ca573fd5aso30241835e9.3 for ; Mon, 09 Sep 2024 11:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1725907156; x=1726511956; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Yg6+XBiIXxH7nJe9SH21mXCwMnJz2G3XE7vtQ8YyjJM=; b=Wyc/9orwlTJ2MyhCtjAbu2ScBdaimflb41Vrv0n8n2SuSY5IrOcus8o0lpzreULcsu xBaE7bXuFV4/Mvs44luS/3rKOgma2NECFUwMIYKz/e7CGmCB0/h+GVFXgCg3n8bBzt0m +YXwvVg8mtssp13/r5murB4sEB6g/urG2WMJMCFxD2sCUEO2xNAEP3KCr+hdOE3zKJM7 CEAnS3+lkBKpu+RoPmVaFZAKJp82GMaFFsed7fI4N1nYM+v2xNqDLHPnekXblZbI+ik5 CqG545k0BDR5L/i75hQqeg3imA7m3MLFyDGgvAeuhu3xiPo0rjCZRgsVKgzJAhYOsRhV AsxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725907156; x=1726511956; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yg6+XBiIXxH7nJe9SH21mXCwMnJz2G3XE7vtQ8YyjJM=; b=quiWSKC8LBMXeVc+pgWxOYRohPsgAykygWIj2dZ8xHgvdjJhkHe7RNY45GhiI00YIe HGNJIOa+g8OwUj8SOZdJ7RWiCHaXyvUIFOSnJbhyh6oTh783z2Qopu8TCAvWWlhaX6CO ZwizytD5PoM5jiaAYoVyTrAu2yCDrPVdfUZ8yh8YjkrK9LuLCDcOZXa0vicNrhFfb5aJ bJsGQY8n9emTAX3tVL4NVoN5WyubHGdn5xJRzCiLpdEYrW7E5mDR0+ObhkXNBLLbg3kW JVs4y6ybqHlft7NdLXskSAzq04NfEtzeKfpZIyp0L0gLcoMc1FgtKHbdE1jnlQzuh1Wa lDkw== X-Gm-Message-State: AOJu0YyG8cxUyptf8YSkiiT2UspmHokPGtmHUSaJt4NuJZ0FL9GVdKVJ E2O+LPXLXnDKC2kejHIbW+MST0nHW55yUSmDhhF2ucKWmyXf/9CwFSg+ILB60yM= X-Google-Smtp-Source: AGHT+IGrIS5RcF1gAShFPX5ZbNkp3oKw0MHQbEpkHH3hFT/uNyMtvuNztNFI/o7WaBbsdaWCSQIpSw== X-Received: by 2002:a05:600c:35ce:b0:42b:8a35:1ade with SMTP id 5b1f17b1804b1-42c9f9d648dmr72352375e9.27.1725907154835; Mon, 09 Sep 2024 11:39:14 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:9c15:247b:9be3:37a7]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956653b0sm6731721f8f.44.2024.09.09.11.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 11:39:14 -0700 (PDT) From: Bartosz Golaszewski Date: Mon, 09 Sep 2024 20:38:45 +0200 Subject: [PATCH 2/2] firmware: qcom: scm: fall back to kcalloc() for no SCM device bound Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-tzmem-null-ptr-v1-2-96526c421bac@linaro.org> References: <20240909-tzmem-null-ptr-v1-0-96526c421bac@linaro.org> In-Reply-To: <20240909-tzmem-null-ptr-v1-0-96526c421bac@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Andrew Halaney , Elliot Berman , Dmitry Baryshkov , Rudraksha Gupta , "Linux regression tracking (Thorsten Leemhuis)" Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2752; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=lHZMPhLJloTJCWEomY4zq8XA0jpQwZflYR5ZjRe6Ibs=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBm30DQM9mZTCNoFEepkkZEa8k8ve6ZB9MBGOGQV GfBunyDzrGJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZt9A0AAKCRARpy6gFHHX ckpBD/9RvVSC1BDheeE3u4dL48Uq/gegv+sOwQlU2od56faoicTrDtYNJ+oSiodF+D1T/3A6ues sb58YKvMD75LyWVbAJReNOfxZHLqZAwLkA3heH5wHKKnCQcBEc01sIwJy1HzhwLXiXRey1sHSXb t79YHSDtL7LjlskurS5rHX410l3IneaD4sgwhsZww1PR/noIABUAuxh9/UjrrLJ+ZXwMrVNAw2P LdP0HpVhit6Zr8ug06XI1/GW+yhpiTFabtjkYe3tkr+7ZEQB7gIzm75esElpY1qOt2tUswkReWZ 63MXnoVqujpT7BBDH+6hiIIaM7K51R3VKjV3F+Gjzhur+nxEUvYXQQ7N0DA0HuGhgJd6hHW+EMn +8SwUv6ULxIMn1CqPfqabUTuw2x26dOgBV6VCsPQIwbRn8j50e4VeyBn+s/0A0rWWLEBwqm5agA vXYHpJyj6hi5ao938moSFz61uOMLO4Pc7/ZTzu9Ew64qspBezCuWADGSL58uqyAvd1sRQJVFFav haqK5U8yhYK0C7yRawq5hlSJW87wdpBQxYBAOvItEWNZ4kX+Xk9ZJrUcV4sBhTYeaTC81ubN79X c0eqVCS4pY74hLwoJzYK45eVNNBx3sa/usEXDbWwwmOeNe8LYvL35SRfSFUV87LpWVf+Qx3oOSX BKuISd1+VkpJZuw== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Older platforms don't have an actual SCM device tied into the driver model and so there's no struct device which to use with the TZ Mem API. We need to fall-back to kcalloc() when allocating the buffer for additional SMC arguments on such platforms which don't even probe the SCM driver and never create the TZMem pool. Fixes: 449d0d84bcd8 ("firmware: qcom: scm: smc: switch to using the SCM allocator") Reported-by: Rudraksha Gupta Closes: https://lore.kernel.org/lkml/692cfe9a-8c05-4ce4-813e-82b3f310019a@gmail.com/ Signed-off-by: Bartosz Golaszewski Tested-by: Rudraksha Gupta --- drivers/firmware/qcom/qcom_scm-smc.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm-smc.c b/drivers/firmware/qcom/qcom_scm-smc.c index 2b4c2826f572..13f72541033c 100644 --- a/drivers/firmware/qcom/qcom_scm-smc.c +++ b/drivers/firmware/qcom/qcom_scm-smc.c @@ -147,6 +147,15 @@ static int __scm_smc_do(struct device *dev, struct arm_smccc_args *smc, return 0; } +static void smc_args_free(void *ptr) +{ + if (qcom_scm_get_tzmem_pool()) + qcom_tzmem_free(ptr); + else + kfree(ptr); +} + +DEFINE_FREE(smc_args, void *, if (!IS_ERR_OR_NULL(_T)) smc_args_free(_T)); int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, enum qcom_scm_convention qcom_convention, @@ -155,7 +164,7 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, struct qcom_tzmem_pool *mempool = qcom_scm_get_tzmem_pool(); int arglen = desc->arginfo & 0xf; int i, ret; - void *args_virt __free(qcom_tzmem) = NULL; + void *args_virt __free(smc_args) = NULL; gfp_t flag = atomic ? GFP_ATOMIC : GFP_KERNEL; u32 smccc_call_type = atomic ? ARM_SMCCC_FAST_CALL : ARM_SMCCC_STD_CALL; u32 qcom_smccc_convention = (qcom_convention == SMC_CONVENTION_ARM_32) ? @@ -173,9 +182,20 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, smc.args[i + SCM_SMC_FIRST_REG_IDX] = desc->args[i]; if (unlikely(arglen > SCM_SMC_N_REG_ARGS)) { - args_virt = qcom_tzmem_alloc(mempool, - SCM_SMC_N_EXT_ARGS * sizeof(u64), - flag); + /* + * Older platforms don't have an entry for SCM in device-tree + * and so no device is bound to the SCM driver. This means there + * is no struct device for the TZ Mem API. Fall back to + * kcalloc() on such platforms. + */ + if (mempool) + args_virt = qcom_tzmem_alloc( + mempool, + SCM_SMC_N_EXT_ARGS * sizeof(u64), + flag); + else + args_virt = kcalloc(SCM_SMC_N_EXT_ARGS, sizeof(u64), + flag); if (!args_virt) return -ENOMEM;