2021-04-01 17:59:14

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] cifsd: use kfree to free memory allocated by kzalloc

On Thu, Apr 01, 2021 at 04:39:33PM +0500, Muhammad Usama Anjum wrote:
> kfree should be used to free memory allocated by kzalloc to avoid
> any overhead and for maintaining consistency.
>
> Fixes: 5dfeb6d945 ("cifsd: use kmalloc() for small allocations")
> Signed-off-by: Muhammad Usama Anjum <[email protected]>
> ---
> This one place was left in earlier patch. I've already received
> responsse on that patch. I'm sending a separate patch.
>
> fs/cifsd/transport_tcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifsd/transport_tcp.c b/fs/cifsd/transport_tcp.c
> index 67163efcf472..040881893417 100644
> --- a/fs/cifsd/transport_tcp.c
> +++ b/fs/cifsd/transport_tcp.c
> @@ -551,7 +551,7 @@ void ksmbd_tcp_destroy(void)
> list_for_each_entry_safe(iface, tmp, &iface_list, entry) {
> list_del(&iface->entry);
> kfree(iface->name);
> - ksmbd_free(iface);
> + kfree(iface);

We should just delete the ksmbd_free() function completely.

I think that cifsd is being re-written though so it might not be worth
it.

regards,
dan carpenter


2021-04-01 18:36:41

by Namjae Jeon

[permalink] [raw]
Subject: Re: [Linux-cifsd-devel] [PATCH] cifsd: use kfree to free memory allocated by kzalloc

2021-04-01 20:50 GMT+09:00, Dan Carpenter <[email protected]>:
> On Thu, Apr 01, 2021 at 04:39:33PM +0500, Muhammad Usama Anjum wrote:
>> kfree should be used to free memory allocated by kzalloc to avoid
>> any overhead and for maintaining consistency.
>>
>> Fixes: 5dfeb6d945 ("cifsd: use kmalloc() for small allocations")
>> Signed-off-by: Muhammad Usama Anjum <[email protected]>
>> ---
>> This one place was left in earlier patch. I've already received
>> responsse on that patch. I'm sending a separate patch.
>>
>> fs/cifsd/transport_tcp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/cifsd/transport_tcp.c b/fs/cifsd/transport_tcp.c
>> index 67163efcf472..040881893417 100644
>> --- a/fs/cifsd/transport_tcp.c
>> +++ b/fs/cifsd/transport_tcp.c
>> @@ -551,7 +551,7 @@ void ksmbd_tcp_destroy(void)
>> list_for_each_entry_safe(iface, tmp, &iface_list, entry) {
>> list_del(&iface->entry);
>> kfree(iface->name);
>> - ksmbd_free(iface);
>> + kfree(iface);
>
> We should just delete the ksmbd_free() function completely.
Yes, I have added your review comment about this to my todo-list.
I will do that.
>
> I think that cifsd is being re-written though so it might not be worth
> it.
Right.
Thanks!
>
> regards,
> dan carpenter
>
>
> _______________________________________________
> Linux-cifsd-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-cifsd-devel
>