From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4F1BA00C4; Wed, 2 Nov 2022 07:51:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7F69340693; Wed, 2 Nov 2022 07:51:11 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 7568A40223 for ; Wed, 2 Nov 2022 07:51:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667371869; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bpYGAcBSAZJema6zYyW8JzL9pcoFYJBnXUQUtiHQItA=; b=LDrultGkjctr08ZYcsrNI39wnI1WE5eg2bP37WCVgedUdgNQlqN7uMDxeBD31FhnlkTBPK POKhvVaEdExM2eZ+C7qQjcuvysOy5NZq9Ano75euV6T/um9wwq5FA4nsq39OqSG0kaTq6p 4jzJhYHDKZkvjjsfqTP5DwoO7icshfM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-60-6dO73tC5Pei9Tfx21ID7Kg-1; Wed, 02 Nov 2022 02:51:04 -0400 X-MC-Unique: 6dO73tC5Pei9Tfx21ID7Kg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 67E521C09C86; Wed, 2 Nov 2022 06:51:04 +0000 (UTC) Received: from [10.39.208.11] (unknown [10.39.208.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F5762166B2D; Wed, 2 Nov 2022 06:51:03 +0000 (UTC) Message-ID: <3daba34f-55d4-5038-fe46-aa2ef32b0fb5@redhat.com> Date: Wed, 2 Nov 2022 07:51:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v1 2/6] baseband/acc: fix to possible overflow To: Nicolas Chautru , dev@dpdk.org, gakhil@marvell.com, hernan.vargas@intel.com References: <20221101230459.50891-1-nicolas.chautru@intel.com> <20221101230459.50891-3-nicolas.chautru@intel.com> From: Maxime Coquelin In-Reply-To: <20221101230459.50891-3-nicolas.chautru@intel.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 11/2/22 00:04, Nicolas Chautru wrote: > Potential overflow issue when casting to 64bits, > notably relevant when extending number of queues. > > Coverity issue: 381665 > Fixes: 32e8b7ea35 ("baseband/acc100: refactor to segregate common code") > Fixes: 40e3adbdd3 ("baseband/acc200: add queue configuration") > > Signed-off-by: Nicolas Chautru > --- > drivers/baseband/acc/rte_acc100_pmd.c | 3 +-- > drivers/baseband/acc/rte_acc200_pmd.c | 2 +- > 2 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c > index 23bc5d25bb..b6e500c6bc 100644 > --- a/drivers/baseband/acc/rte_acc100_pmd.c > +++ b/drivers/baseband/acc/rte_acc100_pmd.c > @@ -888,8 +888,7 @@ acc100_queue_release(struct rte_bbdev *dev, uint16_t q_id) > > if (q != NULL) { > /* Mark the Queue as un-assigned */ > - d->q_assigned_bit_map[q->qgrp_id] &= (0xFFFFFFFFFFFFFFFF - > - (uint64_t) (1 << q->aq_id)); > + d->q_assigned_bit_map[q->qgrp_id] &= (~0ULL - (1 << (uint64_t) q->aq_id)); > rte_free(q->companion_ring_addr); > rte_free(q->lb_in); > rte_free(q->lb_out); > diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c > index 0cbb9a946b..76a5986448 100644 > --- a/drivers/baseband/acc/rte_acc200_pmd.c > +++ b/drivers/baseband/acc/rte_acc200_pmd.c > @@ -964,7 +964,7 @@ acc200_queue_release(struct rte_bbdev *dev, uint16_t q_id) > > if (q != NULL) { > /* Mark the Queue as un-assigned. */ > - d->q_assigned_bit_map[q->qgrp_id] &= (~0ULL - (uint64_t) (1 << q->aq_id)); > + d->q_assigned_bit_map[q->qgrp_id] &= (~0ULL - (1 << (uint64_t) q->aq_id)); > rte_free(q->companion_ring_addr); > rte_free(q->lb_in); > rte_free(q->lb_out); Reviewed-by: Maxime Coquelin Thanks, Maxime