forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: buf: linearize: Never return -ENOMEM, just do what user asked to
Don't try to find "errors" in the values of dst_len and len params passed to net_buf_linearize(). Instead, do what entails with the common sense from the values passed in, specifically: 1. Never read more than dst_len (or it would lead to buffer overflow). 2. It's absolutely ok to read than specified by "len" param, that's why this function returns number of bytes read in the first place. The motivation for this change is that it's not useful with its current behavior. For example, a number of Ethernet drivers linearize a packet to send, but each does it with its own duplicated adhoc routine, because net_buf_linearize() would just return error for the natural use of: net_buf_linearize(buf, sizeof(buf), pkt->frags, 0, sizeof(buf)); Signed-off-by: Paul Sokolovsky <[email protected]>
- Loading branch information
Showing
2 changed files
with
14 additions
and
19 deletions.
There are no files selected for viewing
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
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