From nobody Sat May 18 15:49:30 2024 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+109308+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+109308+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1696398505; cv=none; d=zohomail.com; s=zohoarc; b=V+rhHtmPVrFPVLzbQ/IAvGo1HqN5KpZEEtOLwZh/aKIuNh7RibMPtIGVY86U+NOskeVmPqoqup9ytM6nuSw1sm5qYRt+vCxCOoSo6LEk8m7dN3RGvPZEaqc8ME4qmU/s04Ezd6Sz6P6iqgDSJWtEFpeIiMJOAPsQS9ecd3RMMls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696398505; 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=X0g8OkAl6PQAxK1Nxa44rfgp0uVyR0lGJQR6bd6PCJE=; b=NJbKJPeKN8vUELWIw5ah4+ltVipi8QRQ6bXVaq4VmzSasKOVxTW66ML+ZS8AwZd1634G4XzQMOsnNdaaI0JJRO9b7h++3AV3A0VuTD4LCb9WAjSPigMc3ItiaSZSUL2Eh8L2YTrQ0ehx33putEW0RLjC5esC0+ZskRYGVdaKN1M= 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+109308+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1696398505883347.68525614165446; Tue, 3 Oct 2023 22:48:25 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=SXl1qETatwh295AzZeYVQ9N5Xd01QGQz1VyLpWKSM20=; 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=1696398505; v=1; b=JLJECXXx2Ubk+9OgkaIAdLmmZLiSEEHaXi1HjKut3KYvnmEaxnR11K2saIWSq73m2NTGbPGK LElJ75PqvYMOFFtx+j/a/alrfQXam9ktZzmb6s+VIkWMjBcDVpuCXIL0yQjTZA7PSN/Gx5e5Ebi +8F9LSibq5fqEujxNJc3APrs= X-Received: by 127.0.0.2 with SMTP id JwumYY1788612xFYQWs7agfM; Tue, 03 Oct 2023 22:48:25 -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.web10.12210.1696398505061035225 for ; Tue, 03 Oct 2023 22:48:25 -0700 X-Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-69101d33315so1420974b3a.3 for ; Tue, 03 Oct 2023 22:48:25 -0700 (PDT) X-Gm-Message-State: 51XYENddclLZnFv9j2a3ohrRx1787277AA= X-Google-Smtp-Source: AGHT+IFpeGX8uMrej73YvanU1sfo0lB7fRwPkO30TG2mEVXAb+/Gvv23aDvi+zzR3BDn+QZdSt6KVw== X-Received: by 2002:a05:6a20:12c9:b0:142:aced:c643 with SMTP id v9-20020a056a2012c900b00142acedc643mr1622164pzg.31.1696398504403; Tue, 03 Oct 2023 22:48:24 -0700 (PDT) X-Received: from user-Latitude-5420.. ([106.51.83.242]) by smtp.gmail.com with ESMTPSA id l12-20020a170903244c00b001c0bf60ba5csm2668777pls.272.2023.10.03.22.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 22:48:23 -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/Usb/UsbMouseDxe: Fix REVERSE_INULL Coverity issue Date: Wed, 4 Oct 2023 11:18:17 +0530 Message-Id: <20231004054818.100353-2-rsingh@ventanamicro.com> In-Reply-To: <20231004054818.100353-1-rsingh@ventanamicro.com> References: <20231004054818.100353-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: 1696398508107100007 Content-Type: text/plain; charset="utf-8" From: Ranbir Singh The function USBMouseDriverBindingStart do have ASSERT (UsbMouseDevice !=3D NULL); after AllocateZeroPool, but it is applicable only in DEBUG mode. In RELEASE mode, if for whatever reasons UsbMouseDevice is NULL at this point, the code proceeds to dereference "UsbMouseDevice" afterwards which will lead to CRASH. Hence, for safety add NULL pointer checks always. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4222 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/UsbMouse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c b/MdeModulePkg/Bus= /Usb/UsbMouseDxe/UsbMouse.c index 451d4b934f4c..621d09713b24 100644 --- a/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c +++ b/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c @@ -161,6 +161,10 @@ USBMouseDriverBindingStart ( =20 UsbMouseDevice =3D AllocateZeroPool (sizeof (USB_MOUSE_DEV)); ASSERT (UsbMouseDevice !=3D NULL); + if (UsbMouseDevice =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto ErrorExit; + } =20 UsbMouseDevice->UsbIo =3D UsbIo; UsbMouseDevice->Signature =3D USB_MOUSE_DEV_SIGNATURE; --=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 (#109308): https://edk2.groups.io/g/devel/message/109308 Mute This Topic: https://groups.io/mt/101750273/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- From nobody Sat May 18 15:49:30 2024 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+109309+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+109309+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1696398514; cv=none; d=zohomail.com; s=zohoarc; b=hwx41HJxzGQEGz6FWofA99FTO8cQP9eUWgXcdCwkOln/wJ53OgOcEqaYwWX8+jjkJAfTNLbvwhF7dt1sljnVIZBqpFJ6wlsmGYGT/QaEi8gWH3ug0hM2SaoYo3MXiYgQBswft0W2TkeqBH6ztBpso4rwaMxe7fLzl4cbLbCC/U0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696398514; 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=RoErf3KDx/EHV/18oFqvDOD2NYnSYgVZmsPGME+uTVI=; b=EC6RaEkI7F0ChGbU83tqAjzilLylK1hp7Mem8E/arOR9zBbN+MYRkVXzoh2+vVCgy8VS8UanjZVodDZgHta9vgr8IKvylXG1ot+DSSXqdzldY7Hc/nVsU4hgi1GNnTDag1ULEih0GpLepafIl6jG89R70Jac67mmgVW9AHO5FJI= 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+109309+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1696398514295417.3069944606135; Tue, 3 Oct 2023 22:48:34 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=S038I12Rmg++gXhgyMDjzjZfQG+F/jI/nB8Gd1N7NHE=; 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=1696398514; v=1; b=GQrjwdvxT2TpSCs2k6q6OLbVHAbEw5Y4tS3B0vtkGu+zgVeVfGsilcTOXzh0SMHHRFAF/sc3 sHpoPWIKFIbATWmB4dphuwXZBBnk7nXTfVbHoZeAU26bojEX5W+oVTSxJF+zTzdSVxu47vuyZ7d 4DPSctHVsYFOeGA7wl5Wi6KE= X-Received: by 127.0.0.2 with SMTP id SRgPYY1788612xf6PxA9prZJ; Tue, 03 Oct 2023 22:48:34 -0700 X-Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mx.groups.io with SMTP id smtpd.web11.12281.1696398507433784275 for ; Tue, 03 Oct 2023 22:48:27 -0700 X-Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1c63164a2b6so4451065ad.0 for ; Tue, 03 Oct 2023 22:48:27 -0700 (PDT) X-Gm-Message-State: 8tNGEh5CUQ3pEiSVrJe5qXRlx1787277AA= X-Google-Smtp-Source: AGHT+IHD/hzVtGpvkqoMVjYjtNawYwc+cV3UjjhvY6dbHCJTPEcCDbs2aThMC0p0R2KNXXoxYnlgng== X-Received: by 2002:a17:902:d491:b0:1c7:2e8f:c3b5 with SMTP id c17-20020a170902d49100b001c72e8fc3b5mr2142310plg.20.1696398506710; Tue, 03 Oct 2023 22:48:26 -0700 (PDT) X-Received: from user-Latitude-5420.. ([106.51.83.242]) by smtp.gmail.com with ESMTPSA id l12-20020a170903244c00b001c0bf60ba5csm2668777pls.272.2023.10.03.22.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 22:48:26 -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 2/2] MdeModulePkg/Bus/Usb/UsbMouseDxe: Fix MISSING_BREAK Coverity issues Date: Wed, 4 Oct 2023 11:18:18 +0530 Message-Id: <20231004054818.100353-3-rsingh@ventanamicro.com> In-Reply-To: <20231004054818.100353-1-rsingh@ventanamicro.com> References: <20231004054818.100353-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: 1696398514642100003 Content-Type: text/plain; charset="utf-8" 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=3D4222 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; } =20 + // + // No break; here as this is an intentional fallthrough + // + case 2: // // 2-byte data @@ -99,6 +103,10 @@ GetNextHidItem ( return StartPos; } =20 + // + // No break; here as this is an intentional fallthrough + // + case 3: // // 4-byte data, adjust size --=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 (#109309): https://edk2.groups.io/g/devel/message/109309 Mute This Topic: https://groups.io/mt/101750274/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-