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]
Date:	Tue, 21 Oct 2014 10:05:00 +0200
From:	Cyrille Pitchen <cyrille.pitchen@...el.com>
To:	<dwmw2@...radead.org>, <linux-mtd@...ts.infradead.org>,
	<nicolas.ferre@...el.com>
CC:	<linux-kernel@...r.kernel.org>,
	Cyrille Pitchen <cyrille.pitchen@...el.com>
Subject: [PATCH 2/2] jffs2: fix buffer dump debug output

This patch fixes __jffs2_dbg_dump_buffer(): this function prints a message
claiming to dump len bytes. However, depending on the start offset, the former
code drops up to 31 (JFFS2_BUFDUMP_BYTES_PER_LINE - 1) bytes.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@...el.com>
---
 fs/jffs2/debug.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c
index 07bd5bc..1b515b2 100644
--- a/fs/jffs2/debug.c
+++ b/fs/jffs2/debug.c
@@ -736,30 +736,25 @@ void
 __jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs)
 {
 	int skip;
-	int i;
+	int i, pos;
 
 	printk(JFFS2_DBG_MSG_PREFIX " dump from offset %#08x to offset %#08x (%x bytes).\n",
 		offs, offs + len, len);
-	i = skip = offs % JFFS2_BUFDUMP_BYTES_PER_LINE;
+	i = skip = offs & (JFFS2_BUFDUMP_BYTES_PER_LINE - 1);
 	offs = offs & ~(JFFS2_BUFDUMP_BYTES_PER_LINE - 1);
 
-	if (skip != 0)
-		printk(JFFS2_DBG "%#08x: ", offs);
-
+	printk(JFFS2_DBG "%#08x: ", offs);
 	while (skip--)
 		printk("   ");
 
-	while (i < len) {
-		if ((i % JFFS2_BUFDUMP_BYTES_PER_LINE) == 0 && i != len -1) {
-			if (i != 0)
-				printk("\n");
+	for (pos = 0; pos < len; ++pos, ++i) {
+		if (i == JFFS2_BUFDUMP_BYTES_PER_LINE) {
 			offs += JFFS2_BUFDUMP_BYTES_PER_LINE;
-			printk(JFFS2_DBG "%0#8x: ", offs);
+			printk(JFFS2_DBG "\n%0#8x: ", offs);
+			i = 0;
 		}
 
-		printk("%02x ", buf[i]);
-
-		i += 1;
+		printk("%02x ", buf[pos]);
 	}
 
 	printk("\n");
-- 
1.8.2.2

--
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