lkml.org 
[lkml]   [2020]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] uacce: fix some coding styles
From
Date


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@huawei.com>
> Reviewed-by: Zhou Wang <wangzhou1@hisilicon.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

\
 
 \ /
  Last update: 2020-07-21 08:59    [W:0.047 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site