
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICUGZ2 ---------------------------------------------------------------------- Though passing null pointer to kfree() could be harmless, the error path per malloc failure could be confusing when jumping to kfree() with validated null pointer. Fix this by early return instead of jumping to error handling label. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 199111f939e9..6aee6b66a2cd 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -236,10 +236,8 @@ static long hisi_soc_cache_mgmt_ioctl(struct file *file, u32 cmd, unsigned long kzalloc(sizeof(struct hisi_soc_cache_ioctl_param), GFP_KERNEL); long ret; - if (!param) { - ret = -ENOMEM; - goto out; - } + if (!param) + return -ENOMEM; if (copy_from_user(param, (void __user *)arg, sizeof(*param))) { ret = -EFAULT; -- 2.33.0