-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetworkPkg:Resolved Coverity Issues in MnpDxe #10680
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1305,6 +1305,10 @@ MnpStop ( | |
MnpDeviceData = MnpServiceData->MnpDeviceData; | ||
ASSERT (MnpDeviceData->ConfiguredChildrenNumber > 0); | ||
|
||
if (MnpDeviceData->ConfiguredChildrenNumber <= 0) { | ||
return EFI_OUT_OF_RESOURCES; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not feel like an appropriate return code. Also, if we look at the call path, if we return an error here, we will fall back all the way to MnpConfigure which will itself pass this return value on. But the documentation for MnpConfigure says that for "Others" error codes (as well as for EFI_OUT_OF_RESOURCES), "The MNP child driver instance has been reset to startup defaults.". |
||
} | ||
|
||
// | ||
// Configure the receive filters. | ||
// | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,6 +325,9 @@ MnpInstanceDeliverPacket ( | |
} | ||
|
||
ASSERT (Instance->RcvdPacketQueueSize != 0); | ||
if (Instance->RcvdPacketQueueSize <= 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also UINTN. |
||
return EFI_OUT_OF_RESOURCES; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not feel like an appropriate return value on finding that the packet queue is empty and there is nothing to deliver. |
||
} | ||
|
||
RxDataWrap = NET_LIST_HEAD (&Instance->RcvdPacketQueue, MNP_RXDATA_WRAP, WrapEntry); | ||
if (RxDataWrap->Nbuf->RefCnt > 2) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfiguredChildrenNumber is UINTN - does this change not generate a new Coverity warning?