The size of free_list_lock and free_list is num_possible_cpus,
and cpu id returned by get_cpu() maybe bigger than
num_possible_cpus, due to the non-continuous cpu ids.

Signed-off-by: Li RongQing <lirongq...@baidu.com>
Signed-off-by: Wang Li <wangl...@baidu.com>
---
 drivers/scsi/bnx2fc/bnx2fc_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 5a645b8b9af1..fab1a9f85360 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -472,7 +472,7 @@ struct bnx2fc_cmd *bnx2fc_cmd_alloc(struct bnx2fc_rport 
*tgt)
        u32 free_sqes;
        u32 max_sqes;
        u16 xid;
-       int index = get_cpu();
+       int index = get_cpu() % num_possible_cpus();
 
        max_sqes = BNX2FC_SCSI_MAX_SQES;
        /*
-- 
2.16.2

Reply via email to