Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH v2] smb/client: Fix logically dead code
@ 2024-10-07 15:23 Advait Dhamorikar
  2024-10-07 16:34 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Advait Dhamorikar @ 2024-10-07 15:23 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,
	smfrench, Advait Dhamorikar

The if condition in collect_sample: can never be satisfied
because of a logical contradiction. The indicated dead code
may have performed some action; that action will never occur.

Fixes: 94ae8c3fee94 ("smb: client: compress: LZ77 code improvements cleanup")
Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
v1->v2: update short log and changelog

 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] 2+ messages in thread

* Re: [PATCH v2] smb/client: Fix logically dead code
  2024-10-07 15:23 [PATCH v2] smb/client: Fix logically dead code Advait Dhamorikar
@ 2024-10-07 16:34 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2024-10-07 16:34 UTC (permalink / raw)
  To: Advait Dhamorikar
  Cc: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM, David Howells, Enzo Matsumiya, linux-cifs,
	samba-technical, linux-kernel, skhan, anupnewsmail,
	Colin Ian King

Merged into cifs-2.6.git for-next

(also FYI - a similar patch was submitted soon after this one by
Colin, but was duplicate)

On Mon, Oct 7, 2024 at 10:23 AM Advait Dhamorikar
<advaitdhamorikar@gmail.com> wrote:
>
> The if condition in collect_sample: can never be satisfied
> because of a logical contradiction. The indicated dead code
> may have performed some action; that action will never occur.
>
> Fixes: 94ae8c3fee94 ("smb: client: compress: LZ77 code improvements cleanup")
> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
> ---
> v1->v2: update short log and changelog
>
>  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
>


-- 
Thanks,

Steve

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

end of thread, other threads:[~2024-10-07 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 15:23 [PATCH v2] smb/client: Fix logically dead code Advait Dhamorikar
2024-10-07 16:34 ` Steve French

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