Skip to content
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

Fix 'netsocket: several dynamic allocation results not checked' (#14210) #14706

Closed
wants to merge 2 commits into from
Closed

Fix 'netsocket: several dynamic allocation results not checked' (#14210) #14706

wants to merge 2 commits into from

Conversation

chrisswinchatt-arm
Copy link
Contributor

@chrisswinchatt-arm chrisswinchatt-arm commented May 26, 2021

Summary of changes

(Copied from #14223)

This changes adds std::nowthrow and the checks for allocation failure to all places in the netsocket portion that lacked it. This change addresses #14210.

Impact of changes

add_event_listener in NetworkInterface now returns an error if the method fails. Previous attempts to add the event listener would attempt to use an unchecked standard dynamically allocated ns_list_* item.

In other cases, the dynamically allocated items will now be checked, and if unsuccessful, will return after cleaning up any outstanding issues.

TCPSocket::accept will now check that its own internally allocated new TCPSocket call will succeed, and if not, will clean up the stack resources. This should help when memory is low but an incoming connection requests a connection when the TCPSocket is listening.

Migration actions required

As new calls are now handled, code that did not check against this failure may now check for failure and handle it at the application layer.

add_event_listener now returns nsapi_error_t instead of void. The two return values possible are NSAPI_ERROR_OK and NSAPI_ERROR_NO_MEMORY in the case of memory allocation failure.

Documentation

NetworkInterface.h now has changes to the add_event_listener method. This method will now return nsapi_error_t instead of void. The docstring for the interface has been updated.

Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[x] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@mergify mergify bot added the needs: work label May 26, 2021
@mergify
Copy link

mergify bot commented May 26, 2021

This PR cannot be merged due to conflicts. Please rebase to resolve them.

@ciarmcom ciarmcom requested review from a team May 26, 2021 14:00
@ciarmcom
Copy link
Member

@chrisswinchatt-arm, thank you for your changes.
@ARMmbed/mbed-os-connectivity @ARMmbed/mbed-os-maintainers please review.

pan-
pan- previously requested changes May 27, 2021
connectivity/netsocket/source/NetworkInterface.cpp Outdated Show resolved Hide resolved
connectivity/netsocket/source/TCPSocket.cpp Outdated Show resolved Hide resolved
@paul-szczepanek-arm
Copy link
Member

Pull request type can be set to [x] Patch update. The behaviour does not change unless new configuration option is set so it is not a breaking change.

@mergify mergify bot dismissed pan-’s stale review June 1, 2021 14:31

Pull request has been modified.

Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have missed that one but why targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F401xE/TOOLCHAIN_GCC_ARM/stm32f401xe.ld is deleted ?

@chrisswinchatt-arm
Copy link
Contributor Author

@pan-
I'm not sure how that happened. I've restored the file.

pan-
pan- previously approved these changes Jun 1, 2021
@mergify mergify bot added needs: CI and removed needs: work labels Jun 1, 2021
@JojoS62
Copy link
Contributor

JojoS62 commented Jun 2, 2021

I must have missed that one but why targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F401xE/TOOLCHAIN_GCC_ARM/stm32f401xe.ld is deleted ?

#14601
I've seen also that windows git got confused after this fix, the deleted file is shown as changed in the master branch.

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 2, 2021

@JojoS62 How can I reproduce , can you report as new issue. We should look at it if there is an issue with the file

@ciarmcom
Copy link
Member

ciarmcom commented Jun 2, 2021

This pull request has automatically been marked as stale because it has had no recent activity. @ARMmbed/mbed-os-maintainers, please start CI to get the PR merged.

@ciarmcom ciarmcom added the stale Stale Pull Request label Jun 2, 2021
@adbridge
Copy link
Contributor

adbridge commented Jun 4, 2021

@chrisswinchatt-arm can you take a look at #14661 and the issue that spawned it #14601 ? I'm wondering if you had an out of date mbed-os which caused the problems. It might be safer to rebase your changes needed for this PR on top of the latest mbed-os just to make sure ?

@adbridge adbridge added needs: work and removed needs: CI stale Stale Pull Request labels Jun 4, 2021
@adbridge
Copy link
Contributor

adbridge commented Jun 4, 2021

Pull request type can be set to [x] Patch update. The behaviour does not change unless new configuration option is set so it is not a breaking change.

This is still affecting the API so while not Major it should be Feature. I will update it.

@mergify mergify bot dismissed pan-’s stale review June 7, 2021 09:53

Pull request has been modified.

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 7, 2021

Please rebase instead of merging (the git history should be linear here without merge commits)

@mergify
Copy link

mergify bot commented Jun 7, 2021

This PR cannot be merged due to conflicts. Please rebase to resolve them.

@chrisswinchatt-arm
Copy link
Contributor Author

Re-forked and moved to #14740.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants