[CRIU] [PATCH 11/15] tty: Add bug-on in tty_test_and_set
Cyrill Gorcunov
gorcunov at gmail.com
Fri Sep 7 19:18:32 MSK 2018
To make sure we never overwrite memory by accident.
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
criu/tty.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/criu/tty.c b/criu/tty.c
index 0b96b961f38f..50b7de6812ec 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -522,6 +522,8 @@ static int tty_test_and_set(int bit, unsigned long *bitmap)
{
int ret;
+ BUG_ON(bit >= TTY_BITMAP_BITS);
+
ret = test_bit(bit, bitmap);
if (!ret)
set_bit(bit, bitmap);
--
2.17.1
More information about the CRIU
mailing list