* [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access
@ 2024-02-20 15:21 Michael Kubacki
2024-02-26 17:10 ` 回复: " gaoliming via groups.io
2024-02-27 0:52 ` Rebecca Cran
0 siblings, 2 replies; 3+ messages in thread
From: Michael Kubacki @ 2024-02-20 15:21 UTC (permalink / raw)
To: devel; +Cc: Liming Gao, Ray Ni, Rebecca Cran, Richard Ho
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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 3+ messages in thread
* 回复: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access
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
1 sibling, 0 replies; 3+ messages in thread
From: gaoliming via groups.io @ 2024-02-26 17:10 UTC (permalink / raw)
To: devel, mikuback
Cc: 'Ray Ni', 'Rebecca Cran', 'Richard Ho'
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access
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
1 sibling, 0 replies; 3+ messages in thread
From: Rebecca Cran @ 2024-02-27 0:52 UTC (permalink / raw)
To: mikuback, devel; +Cc: Liming Gao, Ray Ni, Richard Ho
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-27 0:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox