* [PATCH] habanalabs: remove redundant memset
@ 2023-01-07 18:48 Tom Rix
2023-01-08 14:51 ` Oded Gabbay
0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2023-01-07 18:48 UTC (permalink / raw)
To: ogabbay, gregkh, dliberman, osharabi, obitton, talcohen
Cc: dri-devel, linux-kernel, Tom Rix
From reviewing the code, the line
memset(kdata, 0, usize);
is not needed because kdata is either zeroed by
kdata = kzalloc(asize, GFP_KERNEL);
when allocated at runtime or by
char stack_kdata[128] = {0};
at compile time.
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/accel/habanalabs/common/habanalabs_ioctl.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/accel/habanalabs/common/habanalabs_ioctl.c b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
index 619d56c40b30..949d38527160 100644
--- a/drivers/accel/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
@@ -1123,8 +1123,6 @@ static long _hl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg,
retcode = -EFAULT;
goto out_err;
}
- } else if (cmd & IOC_OUT) {
- memset(kdata, 0, usize);
}
retcode = func(hpriv, kdata);
--
2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] habanalabs: remove redundant memset
2023-01-07 18:48 [PATCH] habanalabs: remove redundant memset Tom Rix
@ 2023-01-08 14:51 ` Oded Gabbay
0 siblings, 0 replies; 2+ messages in thread
From: Oded Gabbay @ 2023-01-08 14:51 UTC (permalink / raw)
To: Tom Rix
Cc: gregkh, dliberman, osharabi, obitton, talcohen, dri-devel, linux-kernel
On Sat, Jan 7, 2023 at 8:48 PM Tom Rix <trix@redhat.com> wrote:
>
> From reviewing the code, the line
> memset(kdata, 0, usize);
> is not needed because kdata is either zeroed by
> kdata = kzalloc(asize, GFP_KERNEL);
> when allocated at runtime or by
> char stack_kdata[128] = {0};
> at compile time.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/accel/habanalabs/common/habanalabs_ioctl.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/accel/habanalabs/common/habanalabs_ioctl.c b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
> index 619d56c40b30..949d38527160 100644
> --- a/drivers/accel/habanalabs/common/habanalabs_ioctl.c
> +++ b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
> @@ -1123,8 +1123,6 @@ static long _hl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg,
> retcode = -EFAULT;
> goto out_err;
> }
> - } else if (cmd & IOC_OUT) {
> - memset(kdata, 0, usize);
> }
>
> retcode = func(hpriv, kdata);
> --
> 2.27.0
>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Applied to -next.
Thanks,
Oded
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-08 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 18:48 [PATCH] habanalabs: remove redundant memset Tom Rix
2023-01-08 14:51 ` Oded Gabbay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®