[v3,4/7] baseband/acc: acc100 fix queue mapping to 64 bits

Message ID 20230112193609.273578-5-hernan.vargas@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series baseband/acc: changes for 23.03 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hernan Vargas Jan. 12, 2023, 7:36 p.m. UTC
  Fix potential overflow for Q mapping extension to 64 bits.

Fixes: 32e8b7ea35d ("baseband/acc100: refactor to segregate common code")

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 drivers/baseband/acc/rte_acc100_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Maxime Coquelin Jan. 17, 2023, 10:49 a.m. UTC | #1
On 1/12/23 20:36, Hernan Vargas wrote:
> Fix potential overflow for Q mapping extension to 64 bits.
> 
> Fixes: 32e8b7ea35d ("baseband/acc100: refactor to segregate common code")
> 
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   drivers/baseband/acc/rte_acc100_pmd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
> index eb18cc2215..3660d3b240 100644
> --- a/drivers/baseband/acc/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> @@ -662,7 +662,7 @@ acc100_find_free_queue_idx(struct rte_bbdev *dev,
>   	for (aq_idx = 0; aq_idx < qtop->num_aqs_per_groups; aq_idx++) {
>   		if (((d->q_assigned_bit_map[group_idx] >> aq_idx) & 0x1) == 0) {
>   			/* Mark the Queue as assigned */
> -			d->q_assigned_bit_map[group_idx] |= (1 << aq_idx);
> +			d->q_assigned_bit_map[group_idx] |= (1ULL << aq_idx);
>   			/* Report the AQ Index */
>   			return (group_idx << ACC100_GRP_ID_SHIFT) + aq_idx;
>   		}

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index eb18cc2215..3660d3b240 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -662,7 +662,7 @@  acc100_find_free_queue_idx(struct rte_bbdev *dev,
 	for (aq_idx = 0; aq_idx < qtop->num_aqs_per_groups; aq_idx++) {
 		if (((d->q_assigned_bit_map[group_idx] >> aq_idx) & 0x1) == 0) {
 			/* Mark the Queue as assigned */
-			d->q_assigned_bit_map[group_idx] |= (1 << aq_idx);
+			d->q_assigned_bit_map[group_idx] |= (1ULL << aq_idx);
 			/* Report the AQ Index */
 			return (group_idx << ACC100_GRP_ID_SHIFT) + aq_idx;
 		}