]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.18.51/gfs2-avoid-uninitialized-variable-warning.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.18.51 / gfs2-avoid-uninitialized-variable-warning.patch
1 From 67893f12e5374bbcaaffbc6e570acbc2714ea884 Mon Sep 17 00:00:00 2001
2 From: Arnd Bergmann <arnd@arndb.de>
3 Date: Tue, 26 Jan 2016 13:08:10 -0500
4 Subject: gfs2: avoid uninitialized variable warning
5
6 From: Arnd Bergmann <arnd@arndb.de>
7
8 commit 67893f12e5374bbcaaffbc6e570acbc2714ea884 upstream.
9
10 We get a bogus warning about a potential uninitialized variable
11 use in gfs2, because the compiler does not figure out that we
12 never use the leaf number if get_leaf_nr() returns an error:
13
14 fs/gfs2/dir.c: In function 'get_first_leaf':
15 fs/gfs2/dir.c:802:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
16 fs/gfs2/dir.c: In function 'dir_split_leaf':
17 fs/gfs2/dir.c:1021:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
18
19 Changing the 'if (!error)' to 'if (!IS_ERR_VALUE(error))' is
20 sufficient to let gcc understand that this is exactly the same
21 condition as in IS_ERR() so it can optimize the code path enough
22 to understand it.
23
24 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
25 Signed-off-by: Bob Peterson <rpeterso@redhat.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 fs/gfs2/dir.c | 4 ++--
30 1 file changed, 2 insertions(+), 2 deletions(-)
31
32 --- a/fs/gfs2/dir.c
33 +++ b/fs/gfs2/dir.c
34 @@ -764,7 +764,7 @@ static int get_first_leaf(struct gfs2_in
35 int error;
36
37 error = get_leaf_nr(dip, index, &leaf_no);
38 - if (!error)
39 + if (!IS_ERR_VALUE(error))
40 error = get_leaf(dip, leaf_no, bh_out);
41
42 return error;
43 @@ -980,7 +980,7 @@ static int dir_split_leaf(struct inode *
44
45 index = name->hash >> (32 - dip->i_depth);
46 error = get_leaf_nr(dip, index, &leaf_no);
47 - if (error)
48 + if (IS_ERR_VALUE(error))
49 return error;
50
51 /* Get the old leaf block */