From: "gaoliming via groups.io" <gaoliming=byosoft.com.cn@groups.io>
To: <devel@edk2.groups.io>, <mikuback@linux.microsoft.com>
Cc: "'Ray Ni'" <ray.ni@intel.com>,
"'Rebecca Cran'" <rebecca@bsdio.com>,
"'Richard Ho'" <richardho@ami.com>
Subject: 回复: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access
Date: Tue, 27 Feb 2024 01:10:21 +0800 [thread overview]
Message-ID: <028601da68d6$aeae4ec0$0c0aec40$@byosoft.com.cn> (raw)
In-Reply-To: <20240220152157.212-1-mikuback@linux.microsoft.com>
This change is good to me. Reviewed-by: Liming Gao
<gaoliming@byosoft.com.cn>
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Michael
> Kubacki
> 发送时间: 2024年2月20日 23:22
> 收件人: devel@edk2.groups.io
> 抄送: Liming Gao <gaoliming@byosoft.com.cn>; Ray Ni <ray.ni@intel.com>;
> Rebecca Cran <rebecca@bsdio.com>; Richard Ho <richardho@ami.com>
> 主题: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork:
> Check array index range before access
>
> 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;
> }
> --
> 2.40.1.vfs.0.0
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#115654):
> https://edk2.groups.io/g/devel/message/115654
> Mute This Topic: https://groups.io/mt/104469090/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115977): https://edk2.groups.io/g/devel/message/115977
Mute This Topic: https://groups.io/mt/104586147/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-02-26 17:10 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 [this message]
2024-02-27 0:52 ` Rebecca Cran
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='028601da68d6$aeae4ec0$0c0aec40$@byosoft.com.cn' \
--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