Re: [ext4:dev 40/60] fs/ext4/inode.c:1953 __ext4_journalled_writepage() error: potential NULL dereference 'page_bufs'.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,
	Thanks for the report. Can you check whether this patch
works for you?

Thanks
Tao

From: Tao Ma <boyu.mt@xxxxxxxxxx>
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@xxxxxxxxxx>
Signed-off-by: Tao Ma <boyu.mt@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux