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 B532974004C for ; Thu, 5 Oct 2023 11:00:18 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9wkjME7P7UnnbaU0U6ijGo7u4qtui8/E1Jpw2evS2n0=; c=relaxed/simple; d=groups.io; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition; s=20140610; t=1696503617; v=1; b=JujoegdE0Q9a9qZX2ccas8HuIG1bLWfaJp17eDTMQkrf1NMT2LDvoYJxlYudckVOmlGyW0y8 bXH3OCrUs8cER0XwU6mOdkgbhjEPqdE/TGkEtMpjVO+wEbA4sd8QwCFw6vuYZJCBq1iikfL5Mk8 cf0YbSbTAlnQn70sNwB6XZwo= X-Received: by 127.0.0.2 with SMTP id s4UGYY7687511x6m62zTW7P8; Thu, 05 Oct 2023 04:00:17 -0700 X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web10.12445.1696503616543263023 for ; Thu, 05 Oct 2023 04:00:16 -0700 X-Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3959krMZ015922; Thu, 5 Oct 2023 11:00:14 GMT X-Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tgynhbs7g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Oct 2023 11:00:14 +0000 X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 395B0DJg019561 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 5 Oct 2023 11:00:13 GMT X-Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Thu, 5 Oct 2023 04:00:11 -0700 Date: Thu, 5 Oct 2023 12:00:07 +0100 From: "Leif Lindholm" To: , CC: "rsingh@ventanamicro.com" , "Wu, Hao A" , "Ni, Ray" , Veeresh Sangolli Subject: Re: [edk2-devel] [PATCH v1 2/2] MdeModulePkg/Bus/Usb/UsbMouseDxe: Fix MISSING_BREAK Coverity issues Message-ID: References: <20231004054818.100353-1-rsingh@ventanamicro.com> <20231004054818.100353-3-rsingh@ventanamicro.com> MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-GUID: bF0mylMZZxAHcWXGhpFMmJ5x6564qzhI X-Proofpoint-ORIG-GUID: bF0mylMZZxAHcWXGhpFMmJ5x6564qzhI 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,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: zuKY3abZgN9D36focZIxzVHpx7686176AA= Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=JujoegdE; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.com (policy=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 On Wed, Oct 04, 2023 at 18:46:58 +0000, Michael D Kinney wrote: > I do not prefer special comments for one static analyzer. > > Is there an alternative design/implementation of this code > to make it more readable and not trigger any static analysis > false positives? Not the tidiest, but could rewrite as: case 1: case 2: if (HidItem->Size == 1) { <1 block> } <2 block> That way we're making the code more expressive rather than keeping it convoluted and adding a comment saying "code is convoluted". Regards, Leif > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Ranbir > > Singh > > Sent: Tuesday, October 3, 2023 10:48 PM > > To: devel@edk2.groups.io; rsingh@ventanamicro.com > > Cc: Wu, Hao A ; Ni, Ray ; > > Veeresh Sangolli > > Subject: [edk2-devel] [PATCH v1 2/2] MdeModulePkg/Bus/Usb/UsbMouseDxe: > > Fix MISSING_BREAK Coverity issues > > > > From: Ranbir Singh > > > > The function GetNextHidItem has a switch-case code in which the > > case 1: falls through to case 2: and then case 2: falls through > > to case 3: in the block. > > > > While this may be intentional, it is not evident to any general > > code reader as well as any static analyzer tool. Just adding > > > > // No break; here as this is an intentional fallthrough. > > > > as comment in between makes a reader as well as Coverity happy. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4222 > > > > Cc: Hao A Wu > > Cc: Ray Ni > > Co-authored-by: Veeresh Sangolli > > Signed-off-by: Ranbir Singh > > Signed-off-by: Ranbir Singh > > --- > > MdeModulePkg/Bus/Usb/UsbMouseDxe/MouseHid.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/MdeModulePkg/Bus/Usb/UsbMouseDxe/MouseHid.c > > b/MdeModulePkg/Bus/Usb/UsbMouseDxe/MouseHid.c > > index acc19acd98e0..bc9a4824208b 100644 > > --- a/MdeModulePkg/Bus/Usb/UsbMouseDxe/MouseHid.c > > +++ b/MdeModulePkg/Bus/Usb/UsbMouseDxe/MouseHid.c > > @@ -89,6 +89,10 @@ GetNextHidItem ( > > return StartPos; > > > > } > > > > > > > > + // > > > > + // No break; here as this is an intentional fallthrough > > > > + // > > > > + > > > > case 2: > > > > // > > > > // 2-byte data > > > > @@ -99,6 +103,10 @@ GetNextHidItem ( > > return StartPos; > > > > } > > > > > > > > + // > > > > + // No break; here as this is an intentional fallthrough > > > > + // > > > > + > > > > case 3: > > > > // > > > > // 4-byte data, adjust size > > > > -- > > 2.34.1 > > > > > > > > -=-=-=-=-=-= > > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#109309): > > https://edk2.groups.io/g/devel/message/109309 > > Mute This Topic: https://groups.io/mt/101750274/1643496 > > Group Owner: devel+owner@edk2.groups.io > > Unsubscribe: https://edk2.groups.io/g/devel/unsub > > [michael.d.kinney@intel.com] > > -=-=-=-=-=-= > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109350): https://edk2.groups.io/g/devel/message/109350 Mute This Topic: https://groups.io/mt/101750274/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-