summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-07-02 21:15:37 +0200
committerPaul E. McKenney <paulmck@kernel.org>2020-08-25 03:38:37 +0200
commitde77d4da54d10df97d265e7e99112bfc2fef7d4a (patch)
treef0bc6694bf0ea7c391e2bd90d9f3b32ba2e96209 /kernel
parentscftorture: Make symbol 'scf_torture_rand' static (diff)
downloadlinux-de77d4da54d10df97d265e7e99112bfc2fef7d4a.tar.xz
linux-de77d4da54d10df97d265e7e99112bfc2fef7d4a.zip
scftorture: Check unexpected "switch" statement value
This commit adds a "default" case to the switch statement in scftorture_invoke_one() which contains a WARN_ON_ONCE() and an assignment to ->scfc_out to suppress knock-on warnings. These knock-on warnings could otherwise cause the user to think that there was a memory-ordering problem in smp_call_function() instead of a bug in scftorture.c itself. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/scftorture.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index 9180de73e4e8..d9c01c722e2a 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -357,6 +357,10 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
}
smp_call_function(scf_handler, scfcp, scfsp->scfs_wait);
break;
+ default:
+ WARN_ON_ONCE(1);
+ if (scfcp)
+ scfcp->scfc_out = true;
}
if (scfcp && scfsp->scfs_wait) {
if (WARN_ON_ONCE(!scfcp->scfc_out))