[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0775c541-5802-cdf3-e2aa-c62c027ab8a7@linaro.org>
Date: Tue, 21 Jul 2020 14:57:57 +0800
From: Zhangfei Gao <zhangfei.gao@...aro.org>
To: Kai Ye <yekai13@...wei.com>, linux-accelerators@...ts.ozlabs.org,
linux-kernel@...r.kernel.org, linuxarm@...wei.com
Subject: Re: [PATCH] uacce: fix some coding styles
On 2020/7/20 下午3:18, Kai Ye wrote:
> 1. add some parameter check.
> 2. delete some redundant code.
> 3. modify the module author information.
>
> Signed-off-by: Kai Ye <yekai13@...wei.com>
> Reviewed-by: Zhou Wang <wangzhou1@...ilicon.com>
Thanks Kai.
> ---
> drivers/misc/uacce/uacce.c | 28 +++++++++++++---------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
> index 107028e..2e1af58 100644
> --- a/drivers/misc/uacce/uacce.c
> +++ b/drivers/misc/uacce/uacce.c
> @@ -63,8 +63,12 @@ static long uacce_fops_unl_ioctl(struct file *filep,
> unsigned int cmd, unsigned long arg)
> {
> struct uacce_queue *q = filep->private_data;
> - struct uacce_device *uacce = q->uacce;
> + struct uacce_device *uacce;
> +
> + if (WARN_ON(!q))
> + return -EINVAL;
WARN_ON should not be used in uacce, instead error can be printed in
user space driver.
Error should not be printed in kernel log as pasid can be used by unpriv
user.
And I think we do not need check filep->private_data.
The fd is double checked in __fget_files.
Thanks
Powered by blists - more mailing lists