Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] Fix logically dead code
@ 2024-10-04 10:30 Advait Dhamorikar
  2024-10-04 18:00 ` Shuah Khan
  2024-10-05 20:19 ` David Howells
  0 siblings, 2 replies; 4+ messages in thread
From: Advait Dhamorikar @ 2024-10-04 10:30 UTC (permalink / raw)
  To: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM, David Howells, Enzo Matsumiya
  Cc: linux-cifs, samba-technical, linux-kernel, skhan, anupnewsmail,
	Advait Dhamorikar

The if condition in collect_sample: can never be satisfied
because of a logical contradiction.

Fixes: 94ae8c3fee94 ("smb: client: compress: LZ77 code improvements cleanup")
Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
 fs/smb/client/compress.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/smb/client/compress.c b/fs/smb/client/compress.c
index 63b5a55b7a57..766b4de13da7 100644
--- a/fs/smb/client/compress.c
+++ b/fs/smb/client/compress.c
@@ -166,7 +166,6 @@ static int collect_sample(const struct iov_iter *iter, ssize_t max, u8 *sample)
 	loff_t start = iter->xarray_start + iter->iov_offset;
 	pgoff_t last, index = start / PAGE_SIZE;
 	size_t len, off, foff;
-	ssize_t ret = 0;
 	void *p;
 	int s = 0;
 
@@ -193,9 +192,6 @@ static int collect_sample(const struct iov_iter *iter, ssize_t max, u8 *sample)
 				memcpy(&sample[s], p, len2);
 				kunmap_local(p);
 
-				if (ret < 0)
-					return ret;
-
 				s += len2;
 
 				if (len2 < SZ_2K || s >= max - SZ_2K)
-- 
2.34.1


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

* Re: [PATCH] Fix logically dead code
  2024-10-04 10:30 [PATCH] Fix logically dead code Advait Dhamorikar
@ 2024-10-04 18:00 ` Shuah Khan
  2024-10-04 18:12   ` Christophe JAILLET
  2024-10-05 20:19 ` David Howells
  1 sibling, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2024-10-04 18:00 UTC (permalink / raw)
  To: Advait Dhamorikar, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Tom Talpey, Bharath SM, David Howells,
	Enzo Matsumiya
  Cc: linux-cifs, samba-technical, linux-kernel, anupnewsmail,
	Shuah Khan

On 10/4/24 04:30, Advait Dhamorikar wrote:
> The if condition in collect_sample: can never be satisfied
> because of a logical contradiction.

Add a better change log explaining how you found the problem.

Also your short log is missing subsystem information.
Check submitting patches document for details on how
to write shot logs and change logs.

> 
> Fixes: 94ae8c3fee94 ("smb: client: compress: LZ77 code improvements cleanup")
> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
> ---
>   fs/smb/client/compress.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/fs/smb/client/compress.c b/fs/smb/client/compress.c
> index 63b5a55b7a57..766b4de13da7 100644
> --- a/fs/smb/client/compress.c
> +++ b/fs/smb/client/compress.c
> @@ -166,7 +166,6 @@ static int collect_sample(const struct iov_iter *iter, ssize_t max, u8 *sample)
>   	loff_t start = iter->xarray_start + iter->iov_offset;
>   	pgoff_t last, index = start / PAGE_SIZE;
>   	size_t len, off, foff;
> -	ssize_t ret = 0;
>   	void *p;
>   	int s = 0;
>   
> @@ -193,9 +192,6 @@ static int collect_sample(const struct iov_iter *iter, ssize_t max, u8 *sample)
>   				memcpy(&sample[s], p, len2);
>   				kunmap_local(p);
>   
> -				if (ret < 0)
> -					return ret;
> -

The change itself looks good to me - unless the intent is to
check the return from kunmap_local() and take action based on
it instead of removing the conditional that checks the ret value.

>   				s += len2;
>   
>   				if (len2 < SZ_2K || s >= max - SZ_2K)

thanks,
-- Shuah

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

* Re: [PATCH] Fix logically dead code
  2024-10-04 18:00 ` Shuah Khan
@ 2024-10-04 18:12   ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2024-10-04 18:12 UTC (permalink / raw)
  To: Shuah Khan, Advait Dhamorikar, Steve French, Paulo Alcantara,
	Ronnie Sahlberg, Shyam Prasad N, Tom Talpey, Bharath SM,
	David Howells, Enzo Matsumiya
  Cc: linux-cifs, samba-technical, linux-kernel, anupnewsmail

Le 04/10/2024 à 20:00, Shuah Khan a écrit :
> On 10/4/24 04:30, Advait Dhamorikar wrote:
>> The if condition in collect_sample: can never be satisfied
>> because of a logical contradiction.
> 
> Add a better change log explaining how you found the problem.
> 
> Also your short log is missing subsystem information.
> Check submitting patches document for details on how
> to write shot logs and change logs.
> 
>>
>> Fixes: 94ae8c3fee94 ("smb: client: compress: LZ77 code improvements 
>> cleanup")
>> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
>> ---
>>   fs/smb/client/compress.c | 4 ----
>>   1 file changed, 4 deletions(-)
>>
>> diff --git a/fs/smb/client/compress.c b/fs/smb/client/compress.c
>> index 63b5a55b7a57..766b4de13da7 100644
>> --- a/fs/smb/client/compress.c
>> +++ b/fs/smb/client/compress.c
>> @@ -166,7 +166,6 @@ static int collect_sample(const struct iov_iter 
>> *iter, ssize_t max, u8 *sample)
>>       loff_t start = iter->xarray_start + iter->iov_offset;
>>       pgoff_t last, index = start / PAGE_SIZE;
>>       size_t len, off, foff;
>> -    ssize_t ret = 0;
>>       void *p;
>>       int s = 0;
>> @@ -193,9 +192,6 @@ static int collect_sample(const struct iov_iter 
>> *iter, ssize_t max, u8 *sample)
>>                   memcpy(&sample[s], p, len2);
>>                   kunmap_local(p);
>> -                if (ret < 0)
>> -                    return ret;
>> -
> 
> The change itself looks good to me - unless the intent is to
> check the return from kunmap_local() and take action based on
> it instead of removing the conditional that checks the ret value.

IIUC, kunmap_local() does not return anything.

CJ

> 
>>                   s += len2;
>>                   if (len2 < SZ_2K || s >= max - SZ_2K)
> 
> thanks,
> -- Shuah
> 
> 


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

* Re: [PATCH] Fix logically dead code
  2024-10-04 10:30 [PATCH] Fix logically dead code Advait Dhamorikar
  2024-10-04 18:00 ` Shuah Khan
@ 2024-10-05 20:19 ` David Howells
  1 sibling, 0 replies; 4+ messages in thread
From: David Howells @ 2024-10-05 20:19 UTC (permalink / raw)
  To: Advait Dhamorikar
  Cc: dhowells, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Tom Talpey, Bharath SM, Enzo Matsumiya,
	linux-cifs, samba-technical, linux-kernel, skhan, anupnewsmail

Can you tag your subject with some sort of subsystem ID so that we know what
it affects?  Something like "cifs:" or "smb:" in this case.

Thanks,
David


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

end of thread, other threads:[~2024-10-05 20:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-04 10:30 [PATCH] Fix logically dead code Advait Dhamorikar
2024-10-04 18:00 ` Shuah Khan
2024-10-04 18:12   ` Christophe JAILLET
2024-10-05 20:19 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox