qed: Fix an off by one bug
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Jun 2017 09:10:10 +0000 (12:10 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Jun 2017 19:20:04 +0000 (15:20 -0400)
The p_l2_info->pp_qid_usage[] array has "p_l2_info->queues" elements so
the > here should be a >= or we write beyond the end of the array.

Fixes: bbe3f233ec5e ("qed: Assign a unique per-queue index to queue-cid")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_l2.c

index cb8b05dbfc6e18a649fbbb88247b2f8f47fe48b9..e57699bfbdfa415cd9eb56c04e31f2fe0ad20c80 100644 (file)
@@ -161,7 +161,7 @@ static bool qed_eth_queue_qid_usage_add(struct qed_hwfn *p_hwfn,
 
        mutex_lock(&p_l2_info->lock);
 
-       if (queue_id > p_l2_info->queues) {
+       if (queue_id >= p_l2_info->queues) {
                DP_NOTICE(p_hwfn,
                          "Requested to increase usage for qzone %04x out of %08x\n",
                          queue_id, p_l2_info->queues);