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: <1409840819-18976-11-git-send-email-andriy.shevchenko@linux.intel.com>
Date:	Thu,  4 Sep 2014 17:26:57 +0300
From:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:	Tadeusz Struk <tadeusz.struk@...el.com>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	Mauro Carvalho Chehab <m.chehab@...sung.com>,
	Helge Deller <deller@....de>,
	Ingo Tuchscherer <ingo.tuchscherer@...ibm.com>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	linux-kernel@...r.kernel.org, Joe Perches <joe@...ches.com>,
	Marek Vasut <marex@...x.de>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Vladimir Kondratiev <qca_vkondrat@....qualcomm.com>,
	Benjamin Romer <benjamin.romer@...sys.com>,
	Catalin Marinas <catalin.marinas@....com>,
	Randy Dunlap <rdunlap@...radead.org>
Cc:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v4 10/12] staging: unisys: use seq_hex_dump() to dump buffers

Instead of custom approach let's use recently introduced seq_hex_dump() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 .../unisys/visorchannel/visorchannel_funcs.c       | 26 ++++------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index 947b23c..d8345a6 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -633,15 +633,11 @@ void
 visorchannel_dump_section(VISORCHANNEL *chan, char *s,
 			  int off, int len, struct seq_file *seq)
 {
-	char *buf, *tbuf, *fmtbuf;
-	int fmtbufsize = 0;
-	int i;
+	char *buf;
 	int errcode = 0;
 
-	fmtbufsize = 100 * COVQ(len, 16);
 	buf = kmalloc(len, GFP_KERNEL|__GFP_NORETRY);
-	fmtbuf = kmalloc(fmtbufsize, GFP_KERNEL|__GFP_NORETRY);
-	if (buf == NULL || fmtbuf == NULL)
+	if (buf == NULL)
 		goto Away;
 
 	errcode = visorchannel_read(chan, off, buf, len);
@@ -651,23 +647,9 @@ visorchannel_dump_section(VISORCHANNEL *chan, char *s,
 		goto Away;
 	}
 	seq_printf(seq, "channel %s:\n", s);
-	tbuf = buf;
-	while (len > 0) {
-		i = (len < 16) ? len : 16;
-		hex_dump_to_buffer(tbuf, i, 16, 1, fmtbuf, fmtbufsize, TRUE);
-		seq_printf(seq, "%s\n", fmtbuf);
-		tbuf += 16;
-		len -= 16;
-	}
+	seq_hex_dump(seq, "", DUMP_PREFIX_NONE, 16, 1, buf, len, true);
 
 Away:
-	if (buf != NULL) {
-		kfree(buf);
-		buf = NULL;
-	}
-	if (fmtbuf != NULL) {
-		kfree(fmtbuf);
-		fmtbuf = NULL;
-	}
+	kfree(buf);
 }
 EXPORT_SYMBOL_GPL(visorchannel_dump_section);
-- 
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ