[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1354627545-2792-1-git-send-email-tm@tao.ma>
Date: Tue, 4 Dec 2012 21:25:45 +0800
From: Tao Ma <tm@....ma>
To: dan.carpenter@...cle.com
Cc: tytso@....edu, linux-ext4@...r.kernel.org
Subject: Re: [ext4:dev 40/60] fs/ext4/inode.c:1953 __ext4_journalled_writepage() error: potential NULL dereference 'page_bufs'.
Hi Dan,
Thanks for the report. Can you check whether this patch
works for you?
Thanks
Tao
From: Tao Ma <boyu.mt@...bao.com>
Subject: [PATCH] ext4: Fix a build warning in __ext4_journalled_writepage.
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>
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