lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 24 Mar 2015 18:35:53 -0400
From:	Chengyu Song <csong84@...ech.edu>
To:	joern@...fs.org, prasadjoshi.linux@...il.com, logfs@...fs.org,
	linux-kernel@...r.kernel.org
Cc:	taesoo@...ech.edu, changwoo@...ech.edu, sanidhya@...ech.edu,
	blee@...ech.edu, csong84@...ech.edu
Subject: [PATCH 1/1] logfs: incorrect check for read_cache_page return

read_cache_page returns -EIO on error, so the return should be checked
against ERROR_VALUE instead of NULL.

Signed-off-by: Chengyu Song <csong84@...ech.edu>
---
 fs/logfs/segment.c | 4 ++--
 fs/logfs/super.c   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/logfs/segment.c b/fs/logfs/segment.c
index 7f9b096..2e5d45b 100644
--- a/fs/logfs/segment.c
+++ b/fs/logfs/segment.c
@@ -113,7 +113,7 @@ static void pad_partial_page(struct logfs_area *area)
 
 	if (len % PAGE_SIZE) {
 		page = get_mapping_page(sb, index, 0);
-		BUG_ON(!page); /* FIXME: reserve a pool */
+		BUG_ON(IS_ERR(page)); /* FIXME: reserve a pool */
 		memset(page_address(page) + offset, 0xff, len);
 		if (!PagePrivate(page)) {
 			SetPagePrivate(page);
@@ -135,7 +135,7 @@ static void pad_full_pages(struct logfs_area *area)
 
 	while (no_indizes) {
 		page = get_mapping_page(sb, index, 0);
-		BUG_ON(!page); /* FIXME: reserve a pool */
+		BUG_ON(IS_ERR(page)); /* FIXME: reserve a pool */
 		SetPageUptodate(page);
 		memset(page_address(page), 0xff, PAGE_CACHE_SIZE);
 		if (!PagePrivate(page)) {
diff --git a/fs/logfs/super.c b/fs/logfs/super.c
index 5436029..b5ea89c 100644
--- a/fs/logfs/super.c
+++ b/fs/logfs/super.c
@@ -28,7 +28,7 @@ struct page *emergency_read_begin(struct address_space *mapping, pgoff_t index)
 	int err;
 
 	page = read_cache_page(mapping, index, filler, NULL);
-	if (page)
+	if (!IS_ERR(page))
 		return page;
 
 	/* No more pages available, switch to emergency page */
@@ -196,7 +196,7 @@ static int write_one_sb(struct super_block *sb,
 	int err;
 
 	page = find_sb(sb, &ofs);
-	if (!page)
+	if (IS_ERR(page))
 		return -EIO;
 	ds = page_address(page);
 	segno = seg_no(sb, ofs);
-- 
2.1.0

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

Powered by blists - more mailing lists