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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070412024938.27380.55983.patchbomb.py@localhost>
Date:	Wed, 11 Apr 2007 19:49:38 -0700
From:	Nate Diller <nate.diller@...il.com>
To:	Andrew Morton <akpm@...l.org>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Christoph Hellwig <hch@...radead.org>,
	Roman Zippel <zippel@...ux-m68k.org>,
	Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>,
	David Woodhouse <dwmw2@...radead.org>,
	Dave Kleikamp <shaggy@...tin.ibm.com>,
	Anton Altaparmakov <aia21@...tab.net>,
	Evgeniy Dushistov <dushistov@...l.ru>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	reiserfs-dev@...esys.com
Subject: [PATCH 12/17] partition: remove redundant read_mapping_page error checks

Remove unneeded PageError checking in read_dev_sector(), and clean up the
code a bit.

Can anyone point out why it's OK to use page_address() here on a page which
has not been kmapped?  If it's not OK, then a good number of callers need to
be fixed.

Signed-off-by: Nate Diller <nate.diller@...il.com>

---

diff -urpN -X dontdiff linux-2.6.21-rc6-mm1/fs/partitions/check.c linux-2.6.21-rc6-mm1-test/fs/partitions/check.c
--- linux-2.6.21-rc6-mm1/fs/partitions/check.c	2007-04-09 17:24:03.000000000 -0700
+++ linux-2.6.21-rc6-mm1-test/fs/partitions/check.c	2007-04-10 21:59:01.000000000 -0700
@@ -568,16 +568,12 @@ unsigned char *read_dev_sector(struct bl
 
 	page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)),
 				 NULL);
-	if (!IS_ERR(page)) {
-		if (PageError(page))
-			goto fail;
-		p->v = page;
-		return (unsigned char *)page_address(page) +  ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9);
-fail:
-		page_cache_release(page);
+	if (IS_ERR(page)) {
+		p->v = NULL;
+		return NULL;
 	}
-	p->v = NULL;
-	return NULL;
+	p->v = page;
+	return (unsigned char *)page_address(page) +  ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9);
 }
 
 EXPORT_SYMBOL(read_dev_sector);
-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ