Skip to contentSkip to conversation

fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable

PATCH In review Frank Morales II 2 participants 2 messages Sep 10, 2010 – Sep 12, 2010 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable

Quoted 1 line

From 1c304defc543738f82ccb18fe10b558dd2098d74 Mon Sep 17 00:00:00 2001

From: Frank Morales II <[email protected]>
Date: Fri, 10 Sep 2010 07:34:23 -0700
Subject: [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable

In the function tree_search, the variable prev was used without first being initialized, causing compiler warning messages. Initializing prev to NULL resolved the issue.

Kernal patched against: 2.6.36-rc3 (df423dc7)

---
 fs/btrfs/ordered-data.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/ordered-data.c +1 -1
index e56c72b..fad2616 100644
@@ -141,7 +141,7 @@ static inline struct rb_node *tree_search(struct btrfs_ordered_inode_tree *tree,
 					  u64 file_offset)
 {
 	struct rb_root *root = &tree->tree;
-	struct rb_node *prev;
+	struct rb_node *prev = NULL;
 	struct rb_node *ret;
 	struct btrfs_ordered_extent *entry;
 
Signature · 1 line
1.7.0.4
#1 lore raw

On Fri, Sep 10, 2010 at 5:42 PM, Frank Morales II <[email protected]> wr= ote:

Quoted 1 line
Quoted 1 line

From 1c304defc543738f82ccb18fe10b558dd2098d74 Mon Sep 17 00:00:00 20=

01

Quoted 3 lines

From: Frank Morales II <[email protected]>
Date: Fri, 10 Sep 2010 07:34:23 -0700
Subject: [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for=

using uninitialized variable

Quoted 6 lines

In the function tree_search, the variable prev was used without first being initialized, causing compiler warning messages. Initializing prev to NULL resolved the issue.

Kernal patched against: 2.6.36-rc3 (df423dc7)

I came up with exactly this patch, but this is my commit message:

    Btrfs: fix compilation warning

    fs/btrfs/ordered-data.c: In function =E2=80=98tree_search=E2=80=99:
    fs/btrfs/ordered-data.c:144: warning: =E2=80=98prev=E2=80=99 may be=

used
uninitialized in this function
fs/btrfs/ordered-data.c: In function =E2=80=98btrfs_lookup_first_or=
dered_extent=E2=80=99:

    fs/btrfs/ordered-data.c:144: warning: =E2=80=98prev=E2=80=99 may be=
 used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: =E2=80=98prev=E2=80=99 was decla=
red here
    fs/btrfs/ordered-data.c: In function =E2=80=98btrfs_lookup_ordered_=
extent=E2=80=99:
    fs/btrfs/ordered-data.c:144: warning: =E2=80=98prev=E2=80=99 may be=
 used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: =E2=80=98prev=E2=80=99 was decla=
red here
    fs/btrfs/ordered-data.c: In function =E2=80=98btrfs_lookup_ordered_=
range=E2=80=99:
    fs/btrfs/ordered-data.c:144: warning: =E2=80=98prev=E2=80=99 may be=
 used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: =E2=80=98prev=E2=80=99 was decla=
red here
    fs/btrfs/ordered-data.c: In function =E2=80=98btrfs_dec_test_ordere=
d_pending=E2=80=99:
    fs/btrfs/ordered-data.c:144: warning: =E2=80=98prev=E2=80=99 may be=
 used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: =E2=80=98prev=E2=80=99 was decla=

red here

__tree_search() might not set &prev.

--=20
=46elipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html