Re: [PATCH] uacce: fix some coding styles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Thank you for your prompt reply, we should not add extra checked. 

I will fix it in the next v2.
On 2020/7/21 14:57, Zhangfei Gao wrote:

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@xxxxxxxxxx>
Reviewed-by: Zhou Wang <wangzhou1@xxxxxxxxxxxxx>
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.


[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux