This patch replaces BUG_ON() with WARN_ON() and an appropriate warning message and exit since the condition verified is not influenced by user input. Signed-off-by: Ioana Ciornei <ciorneiioana@xxxxxxxxx> --- net/ceph/messenger.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 9a5e54c..1e5aac6 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -116,21 +116,30 @@ static bool con_flag_valid(unsigned long con_flag) static void con_flag_clear(struct ceph_connection *con, unsigned long con_flag) { - BUG_ON(!con_flag_valid(con_flag)); + if (WARN_ON(!con_flag_valid(con_flag))) { + pr_warn("con_flag_clear called with an invalid flag\n"); + return; + } clear_bit(con_flag, &con->flags); } static void con_flag_set(struct ceph_connection *con, unsigned long con_flag) { - BUG_ON(!con_flag_valid(con_flag)); + if (WARN_ON(!con_flag_valid(con_flag))) { + pr_warn("con_flag_set called with an invalid flag\n"); + return; + } set_bit(con_flag, &con->flags); } static bool con_flag_test(struct ceph_connection *con, unsigned long con_flag) { - BUG_ON(!con_flag_valid(con_flag)); + if (WARN_ON(!con_flag_valid(con_flag))) { + pr_warn("con_flag_test called with an invalid flag\n"); + return false; + } return test_bit(con_flag, &con->flags); } @@ -138,7 +147,10 @@ static bool con_flag_test(struct ceph_connection *con, unsigned long con_flag) static bool con_flag_test_and_clear(struct ceph_connection *con, unsigned long con_flag) { - BUG_ON(!con_flag_valid(con_flag)); + if (WARN_ON(!con_flag_valid(con_flag))) { + pr_warn("con_flag_test_and_clear called with an invalid flag\n"); + return false; + } return test_and_clear_bit(con_flag, &con->flags); } @@ -146,7 +158,10 @@ static bool con_flag_test_and_clear(struct ceph_connection *con, static bool con_flag_test_and_set(struct ceph_connection *con, unsigned long con_flag) { - BUG_ON(!con_flag_valid(con_flag)); + if (WARN_ON(!con_flag_valid(con_flag))) { + pr_warn("con_flag_test_and_set called with an invalid flag\n"); + return false; + } return test_and_set_bit(con_flag, &con->flags); } -- 2.6.4 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html