From c4c19fa17fc201186b2d36324e852854df695fef Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Fri, 4 Apr 2008 11:57:40 +0000 Subject: [PATCH] Fix bug when enabling target on nonzero channel. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@328 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla_isp/linux/isp_scst.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qla_isp/linux/isp_scst.c b/qla_isp/linux/isp_scst.c index aff3ea0cc..800c22311 100644 --- a/qla_isp/linux/isp_scst.c +++ b/qla_isp/linux/isp_scst.c @@ -917,7 +917,8 @@ scsi_target_enadis(bus_chan_t *bc, int en) return (0); } bp = bc->bus; - chan = (bc - bp->bchan) / sizeof (bus_chan_t); + chan = (bc - bp->bchan); + BUG_ON(bp == NULL || chan >= bp->h.r_nchannels); memset(&info, 0, sizeof (info)); info.i_identity = bp->h.r_identity;