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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220209033444.56433-1-chengchaohang@163.com>
Date:   Wed,  9 Feb 2022 11:34:44 +0800
From:   chengchaohang@....com
To:     leon@...nel.org, maorg@...dia.com, jgg@...pe.ca,
        logang@...tatee.com, thunder.leizhen@...wei.com
Cc:     linux-kernel@...r.kernel.org,
        "chaohang.cheng" <chaohang.cheng@...izon.ai>
Subject: [PATCH] lib/scatterlist: Provide scatterlist hexdump.

From: "chaohang.cheng" <chaohang.cheng@...izon.ai>

A scatterlist hexdump is essential during debug, sometimes.

Signed-off-by: chaohang.cheng <chaohang.cheng@...izon.ai>
---
 include/linux/scatterlist.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 7ff9d6386c12..ef8ecaac0016 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -563,4 +563,21 @@ bool sg_miter_skip(struct sg_mapping_iter *miter, off_t offset);
 bool sg_miter_next(struct sg_mapping_iter *miter);
 void sg_miter_stop(struct sg_mapping_iter *miter);
 
+/*
+ * Hexdump scatterlist
+ *
+ * @sg: struct scatterlist* .
+ * it stands for the head of a scatterlist .
+ *
+ * note: print_hex_dump_debug is a dynamic debug .
+ *
+ */
+#define SG_HEXDUMP(sg)							\
+do {									\
+	struct scatterlist *sg_tmp = NULL;				\
+	for (sg_tmp = sg; sg_tmp; sg_tmp = sg_next(sg_tmp))		\
+		print_hex_dump_debug("", DUMP_PREFIX_OFFSET,		\
+			16, 1, sg_virt(sg_tmp), sg_tmp->length, true);	\
+} while (0)
+
 #endif /* _LINUX_SCATTERLIST_H */
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ