[PATCH] ufs: fix return value check in ufs_alloc_lastblock()

From: Wei Yongjun
Date: Fri Sep 21 2012 - 01:51:19 EST


From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>

In case of error, the function ufs_get_locked_page() returns ERR_PTR()
or NULL pointer. The IS_ERR() test in the error handling should be
replaced with IS_ERR_OR_NULL().

dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
---
fs/ufs/truncate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index f04f89f..82426ed 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -391,7 +391,7 @@ static int ufs_alloc_lastblock(struct inode *inode)

lastpage = ufs_get_locked_page(mapping, lastfrag >>
(PAGE_CACHE_SHIFT - inode->i_blkbits));
- if (IS_ERR(lastpage)) {
+ if (IS_ERR_OR_NULL(lastpage)) {
err = -EIO;
goto out;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/