public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] ocfs2: remove useless code in ocfs2_try_to_merge_extent
@ 2024-01-12  4:26 Su Hui
  2024-01-16 20:09 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Su Hui @ 2024-01-12  4:26 UTC (permalink / raw)
  To: mark, jlbec, joseph.qi, nathan, ndesaulniers, morbo, justinstitt
  Cc: Su Hui, ocfs2-devel, linux-kernel, llvm, kernel-janitors

Clang static checker warning: Value stored to 'rec' is never read.
Remove this useless code to silent this warning.

Signed-off-by: Su Hui <suhui@nfschina.com>
---
 fs/ocfs2/alloc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index ea9127ba3208..71729e4326d3 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3743,8 +3743,6 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
 			goto out;
 		}
 
-		rec = &el->l_recs[split_index];
-
 		/*
 		 * Note that we don't pass split_rec here on purpose -
 		 * we've merged it into the rec already.
-- 
2.30.2


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

* Re: [PATCH] ocfs2: remove useless code in ocfs2_try_to_merge_extent
  2024-01-12  4:26 [PATCH] ocfs2: remove useless code in ocfs2_try_to_merge_extent Su Hui
@ 2024-01-16 20:09 ` Andrew Morton
  2024-01-17  1:23   ` Su Hui
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2024-01-16 20:09 UTC (permalink / raw)
  To: Su Hui
  Cc: mark, jlbec, joseph.qi, nathan, ndesaulniers, morbo, justinstitt,
	ocfs2-devel, linux-kernel, llvm, kernel-janitors

On Fri, 12 Jan 2024 12:26:40 +0800 Su Hui <suhui@nfschina.com> wrote:

> Clang static checker warning: Value stored to 'rec' is never read.
> Remove this useless code to silent this warning.
> 
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -3743,8 +3743,6 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
>  			goto out;
>  		}
>  
> -		rec = &el->l_recs[split_index];
> -
>  		/*
>  		 * Note that we don't pass split_rec here on purpose -
>  		 * we've merged it into the rec already.

Then:

		ret = ocfs2_merge_rec_left(path, handle, et, rec,
					   dealloc, split_index);

and ocfs2_merge_rec_left() almost immediately dereferences `rec'.

So this looks quite wrong to me.

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

* Re: [PATCH] ocfs2: remove useless code in ocfs2_try_to_merge_extent
  2024-01-16 20:09 ` Andrew Morton
@ 2024-01-17  1:23   ` Su Hui
  0 siblings, 0 replies; 3+ messages in thread
From: Su Hui @ 2024-01-17  1:23 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mark, jlbec, joseph.qi, nathan, ndesaulniers, morbo, justinstitt,
	ocfs2-devel, linux-kernel, llvm, kernel-janitors

On 2024/1/17 04:09, Andrew Morton wrote:
> On Fri, 12 Jan 2024 12:26:40 +0800 Su Hui <suhui@nfschina.com> wrote:
>
>> Clang static checker warning: Value stored to 'rec' is never read.
>> Remove this useless code to silent this warning.
>>
>> --- a/fs/ocfs2/alloc.c
>> +++ b/fs/ocfs2/alloc.c
>> @@ -3743,8 +3743,6 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
>>   			goto out;
>>   		}
>>   
>> -		rec = &el->l_recs[split_index];
>> -
>>   		/*
>>   		 * Note that we don't pass split_rec here on purpose -
>>   		 * we've merged it into the rec already.
> Then:
>
> 		ret = ocfs2_merge_rec_left(path, handle, et, rec,
> 					   dealloc, split_index);
>
> and ocfs2_merge_rec_left() almost immediately dereferences `rec'.
>
> So this looks quite wrong to me.
>
Oh, really sorry for the noise.
This patch is wrong.

Su Hui


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

end of thread, other threads:[~2024-01-17  1:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-12  4:26 [PATCH] ocfs2: remove useless code in ocfs2_try_to_merge_extent Su Hui
2024-01-16 20:09 ` Andrew Morton
2024-01-17  1:23   ` Su Hui

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