Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190929163028.9665-16-romain.perier@gmail.com>
Date: Sun, 29 Sep 2019 18:30:27 +0200
From: Romain Perier <romain.perier@...il.com>
To: kernel-hardening@...ts.openwall.com
Cc: Kees Cook <keescook@...omium.org>,
	Romain Perier <romain.perier@...il.com>
Subject: [PRE-REVIEW PATCH 15/16] tasklet: convert callbacks prototype for using struct tasklet_struct * arguments

Now that everything has been converted, we can use the new prototype of
the callbacks. This converts the cast macros, the handler field and
the tasklet initialization functions to the new prototype.

Signed-off-by: Romain Perier <romain.perier@...il.com>
---
 include/linux/interrupt.h | 10 +++++-----
 kernel/softirq.c          |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index b5ac24b7fea2..506300396db9 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -594,17 +594,17 @@ struct tasklet_struct
 	struct tasklet_struct *next;
 	unsigned long state;
 	atomic_t count;
-	void (*func)(unsigned long);
+	void (*func)(struct tasklet_struct *);
 };
 
-#define TASKLET_DATA_TYPE		unsigned long
+#define TASKLET_DATA_TYPE		struct tasklet_struct *
 #define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
 
 #define DECLARE_TASKLET(name, func) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), (TASKLET_FUNC_TYPE)func }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func }
 
 #define DECLARE_TASKLET_DISABLED(name, func) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), (TASKLET_FUNC_TYPE)func }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func }
 
 
 enum
@@ -673,7 +673,7 @@ static inline void tasklet_enable(struct tasklet_struct *t)
 extern void tasklet_kill(struct tasklet_struct *t);
 extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
 extern void tasklet_init(struct tasklet_struct *t,
-			 void (*func)(unsigned long));
+			 void (*func)(struct tasklet_struct *));
 
 #define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
 	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
diff --git a/kernel/softirq.c b/kernel/softirq.c
index feb9ac8e6f0b..7415a7c4b494 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -520,7 +520,7 @@ static void tasklet_action_common(struct softirq_action *a,
 				if (!test_and_clear_bit(TASKLET_STATE_SCHED,
 							&t->state))
 					BUG();
-				t->func((TASKLET_DATA_TYPE)t);
+				t->func(t);
 				tasklet_unlock(t);
 				continue;
 			}
@@ -547,7 +547,7 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
 }
 
 void tasklet_init(struct tasklet_struct *t,
-		  void (*func)(unsigned long))
+		  void (*func)(struct tasklet_struct *))
 {
 	t->next = NULL;
 	t->state = 0;
-- 
2.23.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.