From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id C0513740041 for ; Tue, 18 Jul 2023 09:02:07 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=hFgruieEKyiEAmww7C+fGtezRXij8RkWtRP9pW7YDFI=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:Content-Transfer-Encoding; s=20140610; t=1689670926; v=1; b=Lc7ncUvVXOKymppkMtEcZAgrvi1N6eD3FjzzIMqjQ7zXb95/HKrTlgDnpnW/arfWqyyR2kwd RYGG4oF+9vUBwQ7LSm4VR0w+gKqP5ZNsN7UPtNz3xEZ1NWO06+gVQsb+2ZpN2ktQrpfiJZxTPTr T4G4SOyFrZCuVGKNmzTB0Jdw= X-Received: by 127.0.0.2 with SMTP id FLMuYY7687511xw2cVXYltHS; Tue, 18 Jul 2023 02:02:06 -0700 X-Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by mx.groups.io with SMTP id smtpd.web10.5970.1689593918585236682 for ; Mon, 17 Jul 2023 04:38:38 -0700 X-Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-666e916b880so2768156b3a.2 for ; Mon, 17 Jul 2023 04:38:38 -0700 (PDT) X-Gm-Message-State: G4w5baanGUPrmMjmj8oPIdEDx7686176AA= X-Google-Smtp-Source: APBJJlELr5SX/5Vz0XbDTdA4lCPueKkSOhEwTzjrtvvgpO55jtPn1gVGh74/Jb8BX44UaZQxDV7vlQ== X-Received: by 2002:a05:6a20:3d8a:b0:133:7fe3:6831 with SMTP id s10-20020a056a203d8a00b001337fe36831mr12838124pzi.57.1689593917743; Mon, 17 Jul 2023 04:38:37 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1cbd:8dd2:c2bf:93e0:5979:e5e0]) by smtp.gmail.com with ESMTPSA id a23-20020a637f17000000b0055b3af821d5sm12667349pgd.25.2023.07.17.04.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 04:38:37 -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 v1 1/2] MdeModulePkg/Bus/Pci/UhciDxe: Fix BAD_SHIFT Coverity issue Date: Mon, 17 Jul 2023 17:08:30 +0530 Message-Id: <20230717113831.2290882-2-rsingh@ventanamicro.com> In-Reply-To: <20230717113831.2290882-1-rsingh@ventanamicro.com> References: <20230717113831.2290882-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=Lc7ncUvV; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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 simply returning ZERO. 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 --- MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c b/MdeModulePkg/Bus/Pc= i/UhciDxe/UhciSched.c index c08f9496969b..8ddef4b68ccf 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c @@ -214,6 +214,10 @@ UhciConvertPollRate ( =0D ASSERT (Interval !=3D 0);=0D =0D + if (Interval =3D=3D 0) {=0D + return 0;=0D + }=0D +=0D //=0D // Find the index (1 based) of the highest non-zero bit=0D //=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106994): https://edk2.groups.io/g/devel/message/106994 Mute This Topic: https://groups.io/mt/100212109/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-