linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ksmbd: initialize ar to NULL
@ 2023-11-20  2:39 Zongmin Zhou
  2023-11-29  3:31 ` Zongmin Zhou
  0 siblings, 1 reply; 4+ messages in thread
From: Zongmin Zhou @ 2023-11-20  2:39 UTC (permalink / raw)
  To: linkinjeon, sfrench
  Cc: senozhatsky, tom, linux-cifs, linux-kernel, Zongmin Zhou

Initialize ar to NULL to avoid the case of aux_size will be false,
and kfree(ar) without ar been initialized will be unsafe.
But kfree(NULL) is safe.

Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/smb/server/ksmbd_work.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c
index 44bce4c56daf..2510b9f3c8c1 100644
--- a/fs/smb/server/ksmbd_work.c
+++ b/fs/smb/server/ksmbd_work.c
@@ -106,7 +106,7 @@ static inline void __ksmbd_iov_pin(struct ksmbd_work *work, void *ib,
 static int __ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len,
 			       void *aux_buf, unsigned int aux_size)
 {
-	struct aux_read *ar;
+	struct aux_read *ar = NULL;
 	int need_iov_cnt = 1;
 
 	if (aux_size) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ksmbd: initialize ar to NULL
  2023-11-20  2:39 [PATCH] ksmbd: initialize ar to NULL Zongmin Zhou
@ 2023-11-29  3:31 ` Zongmin Zhou
  2023-11-29  4:47   ` Namjae Jeon
  0 siblings, 1 reply; 4+ messages in thread
From: Zongmin Zhou @ 2023-11-29  3:31 UTC (permalink / raw)
  To: linkinjeon, sfrench; +Cc: senozhatsky, tom, linux-cifs, linux-kernel

Friendly ping. I think this patch was forgotten.

Best regards!

On 2023/11/20 10:39, Zongmin Zhou wrote:
> Initialize ar to NULL to avoid the case of aux_size will be false,
> and kfree(ar) without ar been initialized will be unsafe.
> But kfree(NULL) is safe.
>
> Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn>
> Acked-by: Namjae Jeon <linkinjeon@kernel.org>
> ---
>   fs/smb/server/ksmbd_work.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c
> index 44bce4c56daf..2510b9f3c8c1 100644
> --- a/fs/smb/server/ksmbd_work.c
> +++ b/fs/smb/server/ksmbd_work.c
> @@ -106,7 +106,7 @@ static inline void __ksmbd_iov_pin(struct ksmbd_work *work, void *ib,
>   static int __ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len,
>   			       void *aux_buf, unsigned int aux_size)
>   {
> -	struct aux_read *ar;
> +	struct aux_read *ar = NULL;
>   	int need_iov_cnt = 1;
>   
>   	if (aux_size) {

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ksmbd: initialize ar to NULL
  2023-11-29  3:31 ` Zongmin Zhou
@ 2023-11-29  4:47   ` Namjae Jeon
  2023-11-29  5:46     ` Zongmin Zhou
  0 siblings, 1 reply; 4+ messages in thread
From: Namjae Jeon @ 2023-11-29  4:47 UTC (permalink / raw)
  To: Zongmin Zhou; +Cc: sfrench, senozhatsky, tom, linux-cifs, linux-kernel

2023-11-29 12:31 GMT+09:00, Zongmin Zhou <zhouzongmin@kylinos.cn>:
> Friendly ping. I think this patch was forgotten.
Sorry for not sharing it, I have merged it into another patch from
you("ksmbd: prevent memory leak on error return").

Thanks.
>
> Best regards!
>
> On 2023/11/20 10:39, Zongmin Zhou wrote:
>> Initialize ar to NULL to avoid the case of aux_size will be false,
>> and kfree(ar) without ar been initialized will be unsafe.
>> But kfree(NULL) is safe.
>>
>> Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn>
>> Acked-by: Namjae Jeon <linkinjeon@kernel.org>
>> ---
>>   fs/smb/server/ksmbd_work.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c
>> index 44bce4c56daf..2510b9f3c8c1 100644
>> --- a/fs/smb/server/ksmbd_work.c
>> +++ b/fs/smb/server/ksmbd_work.c
>> @@ -106,7 +106,7 @@ static inline void __ksmbd_iov_pin(struct ksmbd_work
>> *work, void *ib,
>>   static int __ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int
>> len,
>>   			       void *aux_buf, unsigned int aux_size)
>>   {
>> -	struct aux_read *ar;
>> +	struct aux_read *ar = NULL;
>>   	int need_iov_cnt = 1;
>>
>>   	if (aux_size) {
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ksmbd: initialize ar to NULL
  2023-11-29  4:47   ` Namjae Jeon
@ 2023-11-29  5:46     ` Zongmin Zhou
  0 siblings, 0 replies; 4+ messages in thread
From: Zongmin Zhou @ 2023-11-29  5:46 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: sfrench, senozhatsky, tom, linux-cifs, linux-kernel

Okay,got it.

Thanks

On 2023/11/29 12:47, Namjae Jeon wrote:
> 2023-11-29 12:31 GMT+09:00, Zongmin Zhou <zhouzongmin@kylinos.cn>:
>> Friendly ping. I think this patch was forgotten.
> Sorry for not sharing it, I have merged it into another patch from
> you("ksmbd: prevent memory leak on error return").
>
> Thanks.
>> Best regards!
>>
>> On 2023/11/20 10:39, Zongmin Zhou wrote:
>>> Initialize ar to NULL to avoid the case of aux_size will be false,
>>> and kfree(ar) without ar been initialized will be unsafe.
>>> But kfree(NULL) is safe.
>>>
>>> Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn>
>>> Acked-by: Namjae Jeon <linkinjeon@kernel.org>
>>> ---
>>>    fs/smb/server/ksmbd_work.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c
>>> index 44bce4c56daf..2510b9f3c8c1 100644
>>> --- a/fs/smb/server/ksmbd_work.c
>>> +++ b/fs/smb/server/ksmbd_work.c
>>> @@ -106,7 +106,7 @@ static inline void __ksmbd_iov_pin(struct ksmbd_work
>>> *work, void *ib,
>>>    static int __ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int
>>> len,
>>>    			       void *aux_buf, unsigned int aux_size)
>>>    {
>>> -	struct aux_read *ar;
>>> +	struct aux_read *ar = NULL;
>>>    	int need_iov_cnt = 1;
>>>
>>>    	if (aux_size) {
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-29  5:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-20  2:39 [PATCH] ksmbd: initialize ar to NULL Zongmin Zhou
2023-11-29  3:31 ` Zongmin Zhou
2023-11-29  4:47   ` Namjae Jeon
2023-11-29  5:46     ` Zongmin Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).