demikernel icon indicating copy to clipboard operation
demikernel copied to clipboard

[catnip] Catnip's `MemoryPool::alloc_mbuf` Function Makes Incorrect Allocation Size Comparison

Open BrianZill opened this issue 3 years ago • 2 comments

Description

Currently in catnip's MemoryPool::alloc_mbuf function there is a check to see "if allocated buffer is big enough" that compares the desired size (a usize taken as u16) against the actually allocated buffer size. This check will yield bogus results for cases where the desired size is greater than u16::MAX but less than u16::MAX + the actually allocated buffer size.

The correct check would promote the actually allocated buffer size from a u16 to a usize and perform the check against the two usizes.

BrianZill avatar Sep 22 '22 21:09 BrianZill

@BrianZill could you add to the description of this issue the permalink for the concerned code?

Thanks!

ppenna avatar Sep 23 '22 17:09 ppenna

I've added permalinks.

This is a low priority bug, as we should never attempt to call alloc_mbuf with such a size.

BrianZill avatar Sep 23 '22 20:09 BrianZill