[Integration] Reject failed Python buddy allocator backing buffer#2402
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a null check after allocating a raw buffer in TransferEnginePy::doBuddyAllocate to prevent pushing a null pointer to the buffer list and avoid potential crashes. There are no review comments to address, and the change looks correct.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
jfeng18
left a comment
There was a problem hiding this comment.
LGTM. Clean minimal fix — checks allocateRawBuffer return before mutating buffer_list_ and free_list_. This prevents the NameError-equivalent in C++ where nullptr seeds the buddy allocator with invalid addresses.
One observation: when allocateRawBuffer fails, the class_id split loop in allocateManagedBuffer will retry doBuddyAllocate at progressively larger class_ids until kMaxClassId, then return nullptr to the caller. This is the correct failure propagation — no further changes needed.
Summary
buffer_list_and the slab free lists unchanged on failureallocateManagedBuffer, which already returns a null addressProblem
The max-class branch appended the result of
allocateRawBufferwithout checking it. On allocation failure or local-memory registration failure, this insertednullptrintobuffer_list_and derived invalid addresses intofree_list_, while reporting success.Fixes #2371.
Validation
git diff --checkupstream/mainTo verify