aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-11-11 14:23:49 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-09 01:39:51 -0500
commit5123662adc873f9a37d7898fe3c285a1f1af59c8 (patch)
treece078b46046df665caee19b4a113d4ca9ced5233
parent36fe66c164a9fdf1ff4ad085b6b68960c6170000 (diff)
lkdtm: clean up sparse warnings
Since lkdtm intentionally does "bad" things, we need to convince sparse that we're doing these things on purpose. This adds an explicit cast to the call to copy_to_user() and marks the spin lock as expecting to dead-lock. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/lkdtm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index a2edb2ee0921..a9a203d5f8d9 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -334,9 +334,10 @@ static void execute_location(void *dst)
334 334
335static void execute_user_location(void *dst) 335static void execute_user_location(void *dst)
336{ 336{
337 /* Intentionally crossing kernel/user memory boundary. */
337 void (*func)(void) = dst; 338 void (*func)(void) = dst;
338 339
339 if (copy_to_user(dst, do_nothing, EXEC_SIZE)) 340 if (copy_to_user((void __user *)dst, do_nothing, EXEC_SIZE))
340 return; 341 return;
341 func(); 342 func();
342} 343}
@@ -408,6 +409,8 @@ static void lkdtm_do_action(enum ctype which)
408 case CT_SPINLOCKUP: 409 case CT_SPINLOCKUP:
409 /* Must be called twice to trigger. */ 410 /* Must be called twice to trigger. */
410 spin_lock(&lock_me_up); 411 spin_lock(&lock_me_up);
412 /* Let sparse know we intended to exit holding the lock. */
413 __release(&lock_me_up);
411 break; 414 break;
412 case CT_HUNG_TASK: 415 case CT_HUNG_TASK:
413 set_current_state(TASK_UNINTERRUPTIBLE); 416 set_current_state(TASK_UNINTERRUPTIBLE);