From 9529f5e5b3ad5cbc7fd22b714a78823a9a9a6c69 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 11 Apr 2017 18:48:36 +0000 Subject: [PATCH] ib_srpt: Ensure that the BUG_ON() argument has no side effects Reported-by: David Butterfield git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7106 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 7850bb661..a16fe69c0 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3530,8 +3530,11 @@ static int srpt_xfer_data(struct srpt_rdma_ch *ch, int ret; if (ioctx->imm_data) { - BUG_ON(!srpt_test_and_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA, - SRPT_STATE_DATA_IN)); + bool res; + + res = srpt_test_and_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA, + SRPT_STATE_DATA_IN); + BUG_ON(!res); if (unlikely(!scst_cmd_get_tgt_data_buff_alloced(cmd))) { unsigned int offset = 0, len; uint8_t *buf;