From 0c66b8aaf71e7f8d63ed821d4e71b06223ab1612 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 26 Mar 2014 03:21:25 +0000 Subject: [PATCH] iscsi-scst: Introduce ARRAY_SIZE() This patch does not change any functionality. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5386 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/nthread.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 488b792d8..a3b2a127e 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1327,8 +1327,7 @@ static int write_data(struct iscsi_conn *conn) loff_t off = 0; int rest; - sBUG_ON(count > (signed)(sizeof(conn->write_iov) / - sizeof(conn->write_iov[0]))); + sBUG_ON(count > ARRAY_SIZE(conn->write_iov)); retry: oldfs = get_fs(); set_fs(KERNEL_DS); @@ -1363,8 +1362,8 @@ retry: break; goto out_iov; } - sBUG_ON(iop > conn->write_iov + sizeof(conn->write_iov) - /sizeof(conn->write_iov[0])); + sBUG_ON(iop > + conn->write_iov + ARRAY_SIZE(conn->write_iov)); iop->iov_base += rest; iop->iov_len -= rest; } @@ -1622,8 +1621,7 @@ static void init_tx_hdigest(struct iscsi_cmnd *cmnd) digest_tx_header(cmnd); - sBUG_ON(conn->write_iop_used >= - (signed)(sizeof(conn->write_iov)/sizeof(conn->write_iov[0]))); + sBUG_ON(conn->write_iop_used >= ARRAY_SIZE(conn->write_iov)); iop = &conn->write_iop[conn->write_iop_used]; conn->write_iop_used++;