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:   Sun, 01 Apr 2018 21:43:39 +0100
From:   David Howells <dhowells@...hat.com>
To:     linux-kernel@...r.kernel.org
Subject: [PATCH 34/45] C++: Fix up use of LIST_POISON*

Implicitly casting void* to a non-void pointer is frowned upon in C++,
though -fpermissive causes it to be accepted.  Fix up LIST_POISON1/2
somewhat to handle this a bit better.

Signed-off-by: David Howells <dhowells@...hat.com>
---

 include/linux/list.h       |    8 ++++----
 include/linux/list_bl.h    |    4 ++--
 include/linux/list_nulls.h |    2 +-
 include/linux/poison.h     |    6 ++++--
 include/linux/rculist.h    |    4 ++--
 include/linux/rculist_bl.h |    2 +-
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/linux/list.h b/include/linux/list.h
index 4b129df4d46b..6aa933e4b109 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -123,8 +123,8 @@ static inline void __list_del_entry(struct list_head *entry)
 static inline void list_del(struct list_head *entry)
 {
 	__list_del_entry(entry);
-	entry->next = LIST_POISON1;
-	entry->prev = LIST_POISON2;
+	entry->next = static_cast<struct list_head *>(LIST_POISON1);
+	entry->prev = static_cast<struct list_head *>(LIST_POISON2);
 }
 
 /**
@@ -654,8 +654,8 @@ static inline void __hlist_del(struct hlist_node *n)
 static inline void hlist_del(struct hlist_node *n)
 {
 	__hlist_del(n);
-	n->next = LIST_POISON1;
-	n->pprev = LIST_POISON2;
+	n->next = HLIST_POISON1;
+	n->pprev = HLIST_POISON2;
 }
 
 static inline void hlist_del_init(struct hlist_node *n)
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 3fc2cc57ba1b..474c87c2e72e 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -105,8 +105,8 @@ static inline void __hlist_bl_del(struct hlist_bl_node *n)
 static inline void hlist_bl_del(struct hlist_bl_node *n)
 {
 	__hlist_bl_del(n);
-	n->next = LIST_POISON1;
-	n->pprev = LIST_POISON2;
+	n->next = ((struct hlist_bl_node *) (0x100 + POISON_POINTER_DELTA));
+	n->pprev = ((struct hlist_bl_node **) (0x200 + POISON_POINTER_DELTA));
 }
 
 static inline void hlist_bl_del_init(struct hlist_bl_node *n)
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
index 3ef96743db8d..6c471fd62c9c 100644
--- a/include/linux/list_nulls.h
+++ b/include/linux/list_nulls.h
@@ -91,7 +91,7 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
 static inline void hlist_nulls_del(struct hlist_nulls_node *n)
 {
 	__hlist_nulls_del(n);
-	n->pprev = LIST_POISON2;
+	n->pprev = (struct hlist_nulls_node **)LIST_POISON2;
 }
 
 /**
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 15927ebc22f2..21544c2bf1a7 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -20,8 +20,10 @@
  * under normal circumstances, used to verify that nobody uses
  * non-initialized list entries.
  */
-#define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
-#define LIST_POISON2  ((void *) 0x200 + POISON_POINTER_DELTA)
+#define LIST_POISON1  ((struct list_head *) (0x100 + POISON_POINTER_DELTA))
+#define LIST_POISON2  ((struct list_head *) (0x200 + POISON_POINTER_DELTA))
+#define HLIST_POISON1  ((struct hlist_node *) (0x100 + POISON_POINTER_DELTA))
+#define HLIST_POISON2  ((struct hlist_node **) (0x200 + POISON_POINTER_DELTA))
 
 /********** include/linux/timer.h **********/
 /*
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 127f534fec94..d7b6a0a697c8 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -425,7 +425,7 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,
 static inline void hlist_del_rcu(struct hlist_node *n)
 {
 	__hlist_del(n);
-	n->pprev = LIST_POISON2;
+	n->pprev = HLIST_POISON2;
 }
 
 /**
@@ -445,7 +445,7 @@ static inline void hlist_replace_rcu(struct hlist_node *old,
 	rcu_assign_pointer(*(struct hlist_node __rcu **)new->pprev, new);
 	if (next)
 		new->next->pprev = &new->next;
-	old->pprev = LIST_POISON2;
+	old->pprev = HLIST_POISON2;
 }
 
 /*
diff --git a/include/linux/rculist_bl.h b/include/linux/rculist_bl.h
index 66e73ec1aa99..e5a2c59deb6d 100644
--- a/include/linux/rculist_bl.h
+++ b/include/linux/rculist_bl.h
@@ -74,7 +74,7 @@ static inline void hlist_bl_del_init_rcu(struct hlist_bl_node *n)
 static inline void hlist_bl_del_rcu(struct hlist_bl_node *n)
 {
 	__hlist_bl_del(n);
-	n->pprev = LIST_POISON2;
+	n->pprev = ((struct hlist_bl_node **) (0x200 + POISON_POINTER_DELTA));
 }
 
 /**

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ