Skip to contentSkip to conversation

kernel/hung_task.c: make type annotations consistent

PATCH New Lukas Bulwahn 1 participant 1 message Oct 22, 2020 Hung task detector

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/hung_task.c: make type annotations consistent

Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler") removed various __user annotations from function signatures as part of its refactoring.

It also removed the __user annotation from proc_dohung_task_timeout_secs() at its declaration in ./sched/sysctl.h, but not at its definition in ./kernel/hung_task.c.

Hence, sparse complains:

  kernel/hung_task.c:271:5: error: \
  symbol 'proc_dohung_task_timeout_secs' redeclared with different type \
  (incompatible argument 3 (different address spaces))

Adjust the annotation at the definition fitting to that refactoring to make sparse happy again, which also resolves this warning from sparse:

  kernel/hung_task.c:277:52: warning: incorrect type in argument 3 \
    (different address spaces)
  kernel/hung_task.c:277:52:    expected void *
  kernel/hung_task.c:277:52:    got void [noderef] __user *buffer

No functional change. No change in object code.

---
 kernel/hung_task.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

please review, test and confirm that the object code does not change.

kernel/hung_task.c +1 -2
index a672db830a94..bb2e3e15c84c 100644
@@ -269,8 +269,7 @@ static long hung_timeout_jiffies(unsigned long last_checked,
  * Process updating of timeout sysctl
  */
 int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
-				  void __user *buffer,
-				  size_t *lenp, loff_t *ppos)
+				  void *buffer, size_t *lenp, loff_t *ppos)
 {
 	int ret;
 
Signature · 1 line
2.17.1