[<prev] [next>] [day] [month] [year] [list]
Date: Tue, 4 Dec 2012 21:39:38 +0800
From: Tao Ma <tm@....ma>
To: linux-ext4@...r.kernel.org
Cc: "Theodore Ts'o" <tytso@....edu>
Subject: [PATCH] ext4: Fix a build warning in __ext4_journalled_writepage.
From: Tao Ma <boyu.mt@...bao.com>
smatch complains:
fs/ext4/inode.c:1953 __ext4_journalled_writepage() error: potential NULL dereference 'page_bufs'.
So add the check for it.
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Cc: "Theodore Ts'o" <tytso@....edu>
Signed-off-by: Tao Ma <boyu.mt@...bao.com>
---
fs/ext4/inode.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index dbc5784..431201b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1956,7 +1956,7 @@ static int __ext4_journalled_writepage(struct page *page,
struct buffer_head *page_bufs = NULL;
handle_t *handle = NULL;
int ret = 0;
- int err;
+ int err = 0;
struct buffer_head *inode_bh = NULL;
ClearPageChecked(page);
@@ -1987,8 +1987,7 @@ static int __ext4_journalled_writepage(struct page *page,
ret = ext4_journal_get_write_access(handle, inode_bh);
err = ext4_handle_dirty_metadata(handle, inode, inode_bh);
-
- } else {
+ } else if (page_bufs) {
ret = ext4_walk_page_buffers(handle, page_bufs, 0, len, NULL,
do_journal_get_write_access);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists