From fe2085dcef1e5d4683c9f5bf32106f4db291a546 Mon Sep 17 00:00:00 2001 From: Manish Bhardwaj Date: Thu, 13 Apr 2023 05:06:38 +0000 Subject: [PATCH] crypto: fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit local variables size is more then recommended values leading to compilation warning. So usign this patch we are fixing below compilation warnigs:- nvidia-oot/drivers/crypto/tegra-nvvse-cryptodev.c: In function ‘tnvvse_crypto_dev_ioctl’: nvidia-oot/drivers/crypto/tegra-nvvse-cryptodev.c:2103:1: warning: the frame size of 2224 bytes is larger than 2048 bytes [-Wframe-larger-than=] Bug 4064812 Change-Id: Ie5f0489c9733451f9a132e146790a18d3dd4d6f9 Signed-off-by: Manish Bhardwaj Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2887287 Reviewed-by: Ashutosh Patel Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Sandeep Trasi GVS: Gerrit_Virtual_Submit --- drivers/crypto/tegra-nvvse-cryptodev.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/tegra-nvvse-cryptodev.c b/drivers/crypto/tegra-nvvse-cryptodev.c index e009c369..5a1e656a 100644 --- a/drivers/crypto/tegra-nvvse-cryptodev.c +++ b/drivers/crypto/tegra-nvvse-cryptodev.c @@ -1880,7 +1880,7 @@ static long tnvvse_crypto_dev_ioctl(struct file *filp, struct tegra_nvvse_aes_gmac_init_ctl aes_gmac_init_ctl; struct tegra_nvvse_aes_gmac_sign_verify_ctl aes_gmac_sign_verify_ctl; struct tegra_nvvse_get_ivc_db get_ivc_db; - struct tegra_nvvse_tsec_get_keyload_status tsec_keyload_status; + struct tegra_nvvse_tsec_get_keyload_status *tsec_keyload_status; int ret = 0; /* @@ -1892,6 +1892,12 @@ static long tnvvse_crypto_dev_ioctl(struct file *filp, return -EPERM; } + tsec_keyload_status = kzalloc(sizeof(*tsec_keyload_status), GFP_KERNEL); + if (!tsec_keyload_status) { + pr_err("%s(): failed to allocate memory\n", __func__); + return -ENOMEM; + } + mutex_lock(&ctx->lock); switch (ioctl_num) { @@ -2075,14 +2081,14 @@ static long tnvvse_crypto_dev_ioctl(struct file *filp, break; case NVVSE_IOCTL_CMDID_TSEC_GET_KEYLOAD_STATUS: - ret = tnvvse_crypto_tsec_get_keyload_status(ctx, &tsec_keyload_status); + ret = tnvvse_crypto_tsec_get_keyload_status(ctx, tsec_keyload_status); if (ret) { pr_err("%s(): Failed to get keyload status:%d\n", __func__, ret); goto out; } - ret = copy_to_user((void __user *)arg, &tsec_keyload_status, - sizeof(tsec_keyload_status)); + ret = copy_to_user((void __user *)arg, tsec_keyload_status, + sizeof(*tsec_keyload_status)); if (ret) { pr_err("%s(): Failed to copy_to_user tsec_keyload_status:%d\n", __func__, ret);