public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kalaivani P" <kalaivanip@ami.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	Kalaivani P <kalaivanip@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>,
	Srinivasan Mani <srinivasanm@ami.com>, Arun K <arunk@ami.com>
Subject: [PATCH] ShellPkg: Multiple Coverity issues were found from EDK2 ShellPkg.
Date: Wed, 28 Dec 2022 11:00:50 +0000	[thread overview]
Message-ID: <20221228105922.294-1-kalaivanip@ami.com> (raw)

Attached is the report for Coverity issues identified in ShellPkg based
on edk2-stable202205.

Cc: Srinivasan Mani <srinivasanm@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Cc: Arun k <arunk@ami.com>
Signed-off-by: Kalaivani P <kalaivanip@ami.com>
---
 ShellPkg/Application/Shell/ShellProtocol.c   |  5 ++++-
 ShellPkg/Library/UefiShellLib/UefiShellLib.c | 11 ++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index e6d20ab164..e4ac7f9554 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -4,6 +4,7 @@


   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>

   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

+  Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>

   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent



@@ -2524,7 +2525,9 @@ ShellSearchHandle (
               EfiShellClose (ShellInfoNode->Handle);

               ShellInfoNode->Handle = NULL;

             }

-          } else if (!EFI_ERROR (Status)) {

+

+           } else if (!EFI_ERROR (Status) && (ShellInfoNode->FullName != NULL)) {

+

             //

             // should be a file

             //

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index a72767bd86..fd76da8ea5 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -3,6 +3,7 @@


   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

   Copyright 2016-2018 Dell Technologies.<BR>

+  Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>

   Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent



@@ -1761,6 +1762,9 @@ ShellCloseFileMetaArg (
   // ASSERT that ListHead is not NULL

   //

   ASSERT (ListHead != NULL);

+  if (ListHead == NULL) {

+    return (SHELL_INVALID_PARAMETER);

+  }



   //

   // Check for UEFI Shell 2.0 protocols

@@ -4377,9 +4381,10 @@ ShellFileHandleReadLine (
     return (EFI_INVALID_PARAMETER);

   }



-  if (Buffer == NULL) {

-    ASSERT (*Size == 0);

-  } else {

+  if ((Buffer == NULL) && (*Size != 0)) {

+    return EFI_INVALID_PARAMETER;

+  }

+  else {

     *Buffer = CHAR_NULL;

   }



--
2.36.0.windows.1
-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.

             reply	other threads:[~2022-12-28 11:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28 11:00 Kalaivani P [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-29  6:56 [PATCH] ShellPkg: Multiple Coverity issues were found from EDK2 ShellPkg kalaivanip

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=20221228105922.294-1-kalaivanip@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