public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Santhosh Kumar V via groups.io" <santhoshkumarv=ami.com@groups.io>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	Santhosh Kumar V <santhoshkumarv@ami.com>
Cc: Sivaraman Nainar <sivaramann@ami.com>,
	Raj V Akilan <rajva@ami.com>,
	Saloni Kasbekar <saloni.kasbekar@intel.com>,
	Zachary Clark-williams <zachary.clark-williams@intel.com>
Subject: [edk2-devel] [PATCH] NetworkPkg:MnpDxe:CoverityIssues
Date: Tue, 21 May 2024 14:13:54 +0000	[thread overview]
Message-ID: <20240521141349.1213-1-santhoshkumarv@ami.com> (raw)

Both the cases have ASSERTs checking that the value is greater than 0. Move the checks to the same location as the ASSERT. I'd also prefer if we return with a failure instead of forcing continuation of the function with an invalid value.

Thanks,
Saloni


Addressed above comments and made changes, please review the latest changes below and kindly review coverity changes for other modules too.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: SanthoshKumarV <santhoshkumarv@ami.com>
---
 NetworkPkg/MnpDxe/MnpConfig.c | 3 +++
 NetworkPkg/MnpDxe/MnpIo.c     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/NetworkPkg/MnpDxe/MnpConfig.c b/NetworkPkg/MnpDxe/MnpConfig.c
index 93587d53aa..12fc80ad0c 100644
--- a/NetworkPkg/MnpDxe/MnpConfig.c
+++ b/NetworkPkg/MnpDxe/MnpConfig.c
@@ -1304,6 +1304,9 @@ MnpStop (
   NET_CHECK_SIGNATURE (MnpServiceData, MNP_SERVICE_DATA_SIGNATURE);

   MnpDeviceData = MnpServiceData->MnpDeviceData;

   ASSERT (MnpDeviceData->ConfiguredChildrenNumber > 0);

+

+  if (MnpDeviceData->ConfiguredChildrenNumber <= 0)

+    return EFI_OUT_OF_RESOURCES;



   //

   // Configure the receive filters.

diff --git a/NetworkPkg/MnpDxe/MnpIo.c b/NetworkPkg/MnpDxe/MnpIo.c
index 087c879c46..24dfad10fa 100644
--- a/NetworkPkg/MnpDxe/MnpIo.c
+++ b/NetworkPkg/MnpDxe/MnpIo.c
@@ -326,6 +326,9 @@ MnpInstanceDeliverPacket (


   ASSERT (Instance->RcvdPacketQueueSize != 0);



+  if (Instance->RcvdPacketQueueSize == 0)

+    return EFI_OUT_OF_RESOURCES;

+

   RxDataWrap = NET_LIST_HEAD (&Instance->RcvdPacketQueue, MNP_RXDATA_WRAP, WrapEntry);

   if (RxDataWrap->Nbuf->RefCnt > 2) {

     //

--
2.42.0.windows.2
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119104): https://edk2.groups.io/g/devel/message/119104
Mute This Topic: https://groups.io/mt/106223813/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



             reply	other threads:[~2024-05-21 14:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21 14:13 Santhosh Kumar V via groups.io [this message]
2024-05-21 21:11 ` [edk2-devel] [PATCH] NetworkPkg:MnpDxe:CoverityIssues Saloni Kasbekar
  -- strict thread matches above, loose matches on Subject: below --
2024-05-10 10:04 Santhosh Kumar V via groups.io
2024-05-17 20:56 ` Saloni Kasbekar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240521141349.1213-1-santhoshkumarv@ami.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox