-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 PacketBuffer allocation size when using LwIP #8226
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Problem LwIP `pbuf_alloc()` was called with a size including the `struct pbuf` header, but expects the size to exclude that. #### Change overview Call `pbuf_alloc()` with the correct size. This imports a fragment of openweave/openweave-core#608 #### Testing Added `PacketBuffer::kMaxSizeWithoutReserve` to the cases checked by `PacketBufferTest::CheckNew()`.
pullapprove
bot
requested review from
andy31415,
bzbarsky-apple,
chrisdecenzo,
Damian-Nordic,
gerickson,
hawk248,
jepenven-silabs and
msandstedt
July 8, 2021 21:10
bzbarsky-apple
approved these changes
Jul 8, 2021
Size increase report for "esp32-example-build" from e55ad30
Full report output
|
andy31415
approved these changes
Jul 9, 2021
msandstedt
approved these changes
Jul 9, 2021
saurabhst
approved these changes
Jul 9, 2021
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this pull request
Jul 9, 2021
#### Problem 1. After project-chip#8226, `PacketBuffer::kMaxSizeWithoutReserve` was wrong on LwIP builds. 2. It is possible for a `PacketBufferHandle::New()` to return a larger buffer than requested (e.g. when using a shared pool allocator), and in particular for it to return a block that is larger than *can* be requested. Attempting `CloneData()` on such a buffer fails with an error message logged by `PacketBufferHandle::New()`. #### Change overview 1. Fix `PacketBuffer::kMaxSizeWithoutReserve`. 2. As long as the excess space is not actually occupied (which would be incorrect, since it exceeds the spec size limit), `CloneData()` copies correctly to a maximum-size buffer. #### Testing Added a unit test to verify that a buffer with excess unused space is clonable, and a buffer with oversize space in use is not.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this pull request
Jul 10, 2021
#### Problem 1. After project-chip#8226, `PacketBuffer::kMaxSizeWithoutReserve` was wrong on LwIP builds. 2. It is possible for a `PacketBufferHandle::New()` to return a larger buffer than requested (e.g. when using a shared pool allocator), and in particular for it to return a block that is larger than *can* be requested. Attempting `CloneData()` on such a buffer fails with an error message logged by `PacketBufferHandle::New()`. #### Change overview 1. Fix `PacketBuffer::kMaxSizeWithoutReserve`. 2. As long as the excess space is not actually occupied (which would be incorrect, since it exceeds the spec size limit), `CloneData()` copies correctly to a maximum-size buffer. #### Testing Added a unit test to verify that a buffer with excess unused space is clonable, and a buffer with oversize space in use is not.
andy31415
pushed a commit
that referenced
this pull request
Jul 12, 2021
* Additional PacketBuffer size fixes. #### Problem 1. After #8226, `PacketBuffer::kMaxSizeWithoutReserve` was wrong on LwIP builds. 2. It is possible for a `PacketBufferHandle::New()` to return a larger buffer than requested (e.g. when using a shared pool allocator), and in particular for it to return a block that is larger than *can* be requested. Attempting `CloneData()` on such a buffer fails with an error message logged by `PacketBufferHandle::New()`. #### Change overview 1. Fix `PacketBuffer::kMaxSizeWithoutReserve`. 2. As long as the excess space is not actually occupied (which would be incorrect, since it exceeds the spec size limit), `CloneData()` copies correctly to a maximum-size buffer. #### Testing Added a unit test to verify that a buffer with excess unused space is clonable, and a buffer with oversize space in use is not. * dynamically allocate test buffer * cast narrowing conversion
nikita-s-wrk
pushed a commit
to nikita-s-wrk/connectedhomeip
that referenced
this pull request
Sep 23, 2021
#### Problem LwIP `pbuf_alloc()` was called with a size including the `struct pbuf` header, but expects the size to exclude that. #### Change overview Call `pbuf_alloc()` with the correct size. This imports a fragment of openweave/openweave-core#608 #### Testing Added `PacketBuffer::kMaxSizeWithoutReserve` to the cases checked by `PacketBufferTest::CheckNew()`.
nikita-s-wrk
pushed a commit
to nikita-s-wrk/connectedhomeip
that referenced
this pull request
Sep 23, 2021
* Additional PacketBuffer size fixes. #### Problem 1. After project-chip#8226, `PacketBuffer::kMaxSizeWithoutReserve` was wrong on LwIP builds. 2. It is possible for a `PacketBufferHandle::New()` to return a larger buffer than requested (e.g. when using a shared pool allocator), and in particular for it to return a block that is larger than *can* be requested. Attempting `CloneData()` on such a buffer fails with an error message logged by `PacketBufferHandle::New()`. #### Change overview 1. Fix `PacketBuffer::kMaxSizeWithoutReserve`. 2. As long as the excess space is not actually occupied (which would be incorrect, since it exceeds the spec size limit), `CloneData()` copies correctly to a maximum-size buffer. #### Testing Added a unit test to verify that a buffer with excess unused space is clonable, and a buffer with oversize space in use is not. * dynamically allocate test buffer * cast narrowing conversion
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
LwIP
pbuf_alloc()
was called with a size including thestruct pbuf
header, but expects the size to exclude that.
Change overview
Call
pbuf_alloc()
with the correct size.This imports a fragment of openweave/openweave-core#608
Testing
Added
PacketBuffer::kMaxSizeWithoutReserve
to the cases checkedby
PacketBufferTest::CheckNew()
.