scftorture: Check unexpected "switch" statement value
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 2 Jul 2020 19:15:37 +0000 (12:15 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 25 Aug 2020 01:38:37 +0000 (18:38 -0700)
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>
kernel/scftorture.c

index 9180de73e4e813663de436cf391d58482696aba9..d9c01c722e2ac8dcd06ccf045a6cf48886f6e5e6 100644 (file)
@@ -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))