qed: Fix an off by one bug
PATCH 1/1 qed: Fix an off by one bug
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 <[email protected]>
drivers/net/ethernet/qlogic/qed/qed_l2.c +1 -1
@@ -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);
Quoted 5 lines
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 <[email protected]>
While it's a theoretical fix [as check is defensive; the queue-id was supposed to be validated before reaching this part], it's still the right. Thanks Dan.
Acked-by Yuval Mintz <[email protected]>
From: Dan Carpenter <[email protected]>
Date: Wed, 14 Jun 2017 12:10:10 +0300
Quoted 5 lines
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 <[email protected]>
Applied.