From nobody Mon Feb 9 00:19:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107789+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107789+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1692164290; cv=none; d=zohomail.com; s=zohoarc; b=adhAxJyxO//ZzeMhcQVvGmLGF33527eoi9VWVu1TWwcxiFXCH3NBkKk7dBmAW+xR5M6kiqKX13hQ8D0Veh3YitxIgkeJsIP0X0C6x94PuIhbQ8qOJjfX2A2N+ibHks6QUsnaENahKNcnNVeH0yRWLW9NCaR2HwBD7JsdOmmoYxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692164290; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=EbFCMKLKxj+Zg+gVei8DB0/Dhwlx0E/ILeW2TzJ+WkY=; b=CHTjLiNCeXNXhJHH1I287Lw/mrq3xncq8bvQqMFAc1WOFwfMRLqZG9p6fc8oVMJBDtzAXsqbQ+qtnlUvEZYAvh1T8aPf6NcajblSsFTahM+F+A7bTj9LKz0hmz6tH3LZGDGJiynMtmCF8Im0en7WjYhrTd5cFkNUPdhHa4vzCHI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107789+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1692164290521973.7777239815625; Tue, 15 Aug 2023 22:38:10 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=pnYjE3icGwfliW85EQel/cM/6I5gsZqImMYIQRFrqhU=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1692164290; v=1; b=fVbyZqBt+05QLOEw1DD1zHOZH2TGBgR++745P+GlYN5DcUeIPA+umHHubhE1DVtN+j28yc+I qYNJxIjl/MHOY2rcawEpxuH2p7N96uP4JhhiSrNeCGtpJ21GSL7xUYttmTFT2wPdEdyTJZv+IVD Zf0OFVCCuvi/OGw83ZKDQGaA= X-Received: by 127.0.0.2 with SMTP id IJMqYY1788612xJUmv0K00uf; Tue, 15 Aug 2023 22:38:10 -0700 X-Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mx.groups.io with SMTP id smtpd.web11.154668.1692164289223126602 for ; Tue, 15 Aug 2023 22:38:09 -0700 X-Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6887b3613e4so458978b3a.3 for ; Tue, 15 Aug 2023 22:38:09 -0700 (PDT) X-Gm-Message-State: VUOUkIXZt36ve6yl43TNGyYbx1787277AA= X-Google-Smtp-Source: AGHT+IEQHN8ZwGbz9+5hcV00hIAd6EHln9OXbu/gfu+XFYhEJtvZ/DQMzneSnj8vX84ZU9qxV53URw== X-Received: by 2002:a05:6a21:7985:b0:13b:c4a8:1a68 with SMTP id bh5-20020a056a21798500b0013bc4a81a68mr1215337pzc.34.1692164288561; Tue, 15 Aug 2023 22:38:08 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([106.51.83.242]) by smtp.gmail.com with ESMTPSA id p2-20020aa78602000000b006889081281bsm424737pfn.138.2023.08.15.22.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 22:38:08 -0700 (PDT) From: "Ranbir Singh" To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni , Veeresh Sangolli Subject: [edk2-devel] [PATCH v2 1/2] MdeModulePkg/Bus/Pci/UhciDxe: Fix BAD_SHIFT Coverity issue Date: Wed, 16 Aug 2023 11:08:02 +0530 Message-Id: <20230816053803.1142517-2-rsingh@ventanamicro.com> In-Reply-To: <20230816053803.1142517-1-rsingh@ventanamicro.com> References: <20230816053803.1142517-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rsingh@ventanamicro.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1692164291099100004 Content-Type: text/plain; charset="utf-8" From: Ranbir Singh The function UhciConvertPollRate has a check ASSERT (Interval !=3D 0); but this comes into play only in DEBUG mode. In Release mode, there is no handling if the Interval parameter value is ZERO. To avoid shifting by a negative amount later in the code flow in this undesirable case, it is better to handle it as well by treating it same as if 1 is sent. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4211 Cc: Hao A Wu Cc: Ray Ni Co-authored-by: Veeresh Sangolli Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c b/MdeModulePkg/Bus/Pc= i/UhciDxe/UhciSched.c index c08f9496969b..408e7d5ab7f3 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c @@ -197,7 +197,7 @@ UhciDestoryFrameList ( } =20 /** - Convert the poll rate to the maxium 2^n that is smaller + Convert the poll rate to the maximum 2^n that is smaller than Interval. =20 @param Interval The poll rate to convert. @@ -214,6 +214,14 @@ UhciConvertPollRate ( =20 ASSERT (Interval !=3D 0); =20 + // + // To safeguard RELEASE mode wherein ASSERT is effectively not there, + // if inadvertently Interval is still 0 here, treat it the same as 1. + // + if (Interval =3D=3D 0) { + Interval =3D 1; + } + // // Find the index (1 based) of the highest non-zero bit // --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107789): https://edk2.groups.io/g/devel/message/107789 Mute This Topic: https://groups.io/mt/100774224/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-