public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@bsdio.com>
To: mikuback@linux.microsoft.com, devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>, Ray Ni <ray.ni@intel.com>,
	Richard Ho <richardho@ami.com>
Subject: Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access
Date: Mon, 26 Feb 2024 17:52:41 -0700	[thread overview]
Message-ID: <8ad1f71e-ac77-49fb-88e1-5a0e0ade7c83@bsdio.com> (raw)
In-Reply-To: <20240220152157.212-1-mikuback@linux.microsoft.com>

Reviewed-by: Rebecca Cran <rebecca@bsdio.com>

On 2/20/2024 8:21 AM, mikuback@linux.microsoft.com wrote:
> From: Michael Kubacki <michael.kubacki@microsoft.com>
>
> Checks that an offset used to access array elements is within the
> expected range before accessing the array item.
>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Richard Ho <richardho@ami.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
>   MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c  | 2 +-
>   MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c  | 2 +-
>   MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c | 2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
> index 29f4508a38ce..0c1f252b85df 100644
> --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
> +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
> @@ -769,7 +769,7 @@ ConvertFilter (
>   
>     Count = sizeof (gTable)/sizeof (gTable[0]);
>   
> -  for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
> +  for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
>       if (gTable[Index].Src & Value) {
>         *CdcFilter |= gTable[Index].Dst;
>       }
> diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
> index baa2225bf8a8..ef01a6f5458c 100644
> --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
> +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
> @@ -855,7 +855,7 @@ ConvertFilter (
>   
>     Count = sizeof (gTable)/sizeof (gTable[0]);
>   
> -  for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
> +  for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
>       if (gTable[Index].Src & Value) {
>         *CdcFilter |= gTable[Index].Dst;
>       }
> diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
> index 2c0dcae4cf96..6d45a1b775ba 100644
> --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
> +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
> @@ -803,7 +803,7 @@ ConvertFilter (
>   
>     Count = sizeof (gTable)/sizeof (gTable[0]);
>   
> -  for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
> +  for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
>       if (gTable[Index].Src & Value) {
>         *CdcFilter |= gTable[Index].Dst;
>       }




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



      parent reply	other threads:[~2024-02-27  0:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 15:21 [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access Michael Kubacki
2024-02-26 17:10 ` 回复: " gaoliming via groups.io
2024-02-27  0:52 ` Rebecca Cran [this message]

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=8ad1f71e-ac77-49fb-88e1-5a0e0ade7c83@bsdio.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