From 9955ef762700ec78b6d589e2fc9cf4054c30fecb Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 15 Nov 2009 13:14:40 +0000 Subject: [PATCH] Since the expression "sizeof(*sense) + sizeof(*sense) % 4" did not make sense, replaced this expression by "sizeof(*sense)" and a BUILD_BUG_ON() statement that verifies that sizeof(*sense) is a multiple of four. Should the first expression have been "roundup(sizeof(*sense), 4)" ? git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1336 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 37aeab09a..0d6e82fea 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -1146,8 +1146,9 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, int sense_data_len; int resp_len; - sense_data_len = (s_key == NO_SENSE) ? 0 - : sizeof(*sense) + sizeof(*sense) % 4; + BUILD_BUG_ON((sizeof(*sense) % 4) != 0); + + sense_data_len = (s_key == NO_SENSE) ? 0 : sizeof(*sense); resp_len = sizeof(*srp_rsp) + sense_data_len; srp_rsp = ioctx->buf;