aboutsummaryrefslogtreecommitdiff
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorDaniel Thompson <[email protected]>2019-10-25 08:33:25 +0100
committerDaniel Thompson <[email protected]>2019-10-28 12:02:21 +0000
commitd04213af90935d8b247c1327c9ea142fc037165f (patch)
treeacb625f166ec6fdffb70bda937c4bf9fc8305c85 /security/selinux/hooks.c
parent53b63136e81220cb2f8b541c03a1df9199896821 (diff)
kdb: Simplify code to fetch characters from console
Currently kdb_read_get_key() contains complex control flow that, on close inspection, turns out to be unnecessary. In particular: 1. It is impossible to enter the branch conditioned on (escape_delay == 1) except when the loop enters with (escape_delay == 2) allowing us to combine the branches. 2. Most of the code conditioned on (escape_delay == 2) simply modifies local data and then breaks out of the loop causing the function to return escape_data[0]. 3. Based on #2 there is not actually any need to ever explicitly set escape_delay to 2 because we it is much simpler to directly return escape_data[0] instead. 4. escape_data[0] is, for all but one exit path, known to be '\e'. Simplify the code based on these observations. There is a subtle (and harmless) change of behaviour resulting from this simplification: instead of letting the escape timeout after ~1998 milliseconds we now timeout after ~2000 milliseconds Signed-off-by: Daniel Thompson <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'security/selinux/hooks.c')
0 files changed, 0 insertions, 0 deletions