linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: scrub: initialize variable explicitly
@ 2023-06-08  2:49 Ou Shixiong
  2023-06-08  5:18 ` Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: Ou Shixiong @ 2023-06-08  2:49 UTC (permalink / raw)
  To: Chris Mason
  Cc: Josef Bacik, David Sterba, linux-btrfs, linux-kernel, Ou Shixiong

[-- Attachment #1: Type: text/plain, Size: 734 bytes --]


Fix error of
error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Signed-off-by: Ou Shixiong <oushixiong@kylinos.cn>
---
 fs/btrfs/scrub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 28caad17ccc7..0d5c87c52c33 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1962,7 +1962,7 @@ static int scrub_simple_mirror(struct scrub_ctx *sctx,
 	/* An artificial limit, inherit from old scrub behavior */
 	struct btrfs_path path = { 0 };
 	u64 cur_logical = logical_start;
-	int ret;
+	int ret = 0;
 
 	/* The range must be inside the bg */
 	ASSERT(logical_start >= bg->start && logical_end <= bg->start + bg->length);
-- 
2.25.1


[-- Attachment #2: Type: text/plain, Size: 82 bytes --]

Content-type: Text/plain

No virus found
		Checked by Hillstone Network AntiVirus

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

* Re: [PATCH] btrfs: scrub: initialize variable explicitly
  2023-06-08  2:49 [PATCH] btrfs: scrub: initialize variable explicitly Ou Shixiong
@ 2023-06-08  5:18 ` Qu Wenruo
  2023-06-08 12:46   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2023-06-08  5:18 UTC (permalink / raw)
  To: Ou Shixiong, Chris Mason
  Cc: Josef Bacik, David Sterba, linux-btrfs, linux-kernel



On 2023/6/8 10:49, Ou Shixiong wrote:
>
> Fix error of
> error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> Signed-off-by: Ou Shixiong <oushixiong@kylinos.cn>

Not again.

Please explain how @ret can be uninitialized, and your toolchain version.

To me, this looks like a false alert, and it's possible your toolchain
is out of date or lacks certain backports.

Thanks,
Qu
> ---
>   fs/btrfs/scrub.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 28caad17ccc7..0d5c87c52c33 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -1962,7 +1962,7 @@ static int scrub_simple_mirror(struct scrub_ctx *sctx,
>   	/* An artificial limit, inherit from old scrub behavior */
>   	struct btrfs_path path = { 0 };
>   	u64 cur_logical = logical_start;
> -	int ret;
> +	int ret = 0;
>
>   	/* The range must be inside the bg */
>   	ASSERT(logical_start >= bg->start && logical_end <= bg->start + bg->length);
>
>
> Content-type: Text/plain
>
> No virus found
> 		Checked by Hillstone Network AntiVirus

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

* Re: [PATCH] btrfs: scrub: initialize variable explicitly
  2023-06-08  5:18 ` Qu Wenruo
@ 2023-06-08 12:46   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2023-06-08 12:46 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: Ou Shixiong, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
	linux-kernel

On Thu, Jun 08, 2023 at 01:18:20PM +0800, Qu Wenruo wrote:
> 
> 
> On 2023/6/8 10:49, Ou Shixiong wrote:
> >
> > Fix error of
> > error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >
> > Signed-off-by: Ou Shixiong <oushixiong@kylinos.cn>
> 
> Not again.
> 
> Please explain how @ret can be uninitialized, and your toolchain version.
> 
> To me, this looks like a false alert, and it's possible your toolchain
> is out of date or lacks certain backports.

Yeah, for obvious false altert warnings at least we need to know the
compiler, version and architecture.

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

end of thread, other threads:[~2023-06-08 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08  2:49 [PATCH] btrfs: scrub: initialize variable explicitly Ou Shixiong
2023-06-08  5:18 ` Qu Wenruo
2023-06-08 12:46   ` David Sterba

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).