net/ptpd: Change the dynamic memory allocation method to a static allocation method #3319
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.
Summary
In some scenarios, dynamic memory allocation is not allowed, so it is modified to a static allocation method.
By reading through the code, in the
ptp_sendmsgfunction, the maximum value ofbuflenissizeof (struct ptp_announce_s), so thechar raw [sizeof (struct ether_ceader)+buflen];is changed tochar raw [sizeof (struct ether_ceader)+sizeof (struct ptp_announce_s);Impact
No modification of user interface, no impact on functionality.
Testing
Use the development board to set up the GPTP runtime environment and test the clock synchronization function. After testing, gptp function is normal.