diff options
author | Oded Gabbay | 2022-05-11 12:55:30 +0300 |
---|---|---|
committer | Greg Kroah-Hartman | 2022-05-22 21:01:20 +0200 |
commit | 804d514d7977adbdacb3d4b23bc7d35914fe8930 (patch) | |
tree | bf40d77f14a0139a8c5fc938448c81069365be34 /drivers/misc | |
parent | 49d2a8af97a20d65d09ac85b57e525b32fdaa0e4 (diff) |
habanalabs: return -EFAULT on copy_to_user error
If copy_to_user failed in info ioctl, we always return -EFAULT so the
user will know there was an error.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/habanalabs/common/habanalabs_ioctl.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c index 51fa56287309..8fd2b427863f 100644 --- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c +++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c @@ -118,7 +118,6 @@ static int hw_events_info(struct hl_device *hdev, bool aggregate, static int events_info(struct hl_fpriv *hpriv, struct hl_info_args *args) { - int rc; u32 max_size = args->return_size; u64 events_mask; void __user *out = (void __user *) (uintptr_t) args->return_pointer; @@ -131,8 +130,7 @@ static int events_info(struct hl_fpriv *hpriv, struct hl_info_args *args) hpriv->notifier_event.events_mask = 0; mutex_unlock(&hpriv->notifier_event.lock); - rc = copy_to_user(out, &events_mask, sizeof(u64)); - return rc; + return copy_to_user(out, &events_mask, sizeof(u64)) ? -EFAULT : 0; } static int dram_usage_info(struct hl_fpriv *hpriv, struct hl_info_args *args) |