[PATCH 2/2] Memory Allocation: Fixes ms_idx jump (lookbehind) during find_prev_n() in fb_array library
    Burakov, Anatoly 
    anatoly.burakov at intel.com
       
    Tue May 16 16:20:12 CEST 2023
    
    
  
Hi Vipin,
This commit should include a more detailed commit message, akin to one I 
suggested for the first patch.
For the patch itself:
Reviewed-by: Anatoly Burakov <anatoly.burakov at intel.com>
On 1/13/2023 1:08 PM, Vipin P R wrote:
> Cc: stable at dpdk.org
> 
> Signed-off-by: Vipin P R <vipinp at vmware.com>
> Acked-by: Kumara Parameshwaran <kparameshwar at vmware.com>
> ---
>   lib/eal/common/eal_common_fbarray.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c
> index 551bd87..90240e8 100644
> --- a/lib/eal/common/eal_common_fbarray.c
> +++ b/lib/eal/common/eal_common_fbarray.c
> @@ -511,7 +511,7 @@ find_prev_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n,
>   				 * as well, so skip that on next iteration.
>   				 */
>   				ignore_msk = UINT64_MAX << need;
> -				msk_idx = lookbehind_idx;
> +				msk_idx = lookbehind_idx + 1;
>   				break;
>   			}
>   
The unit test code you suggested does not cover this case. I've reduced 
this bug to a minimal test case:
1. Allocate fbarray with 256 entries
2. Set idx 63 as used
3. Call rte_fbarray_find_prev_n_free() starting with index 64 and length 
of 2
Returned value should be 61, but without the fix it returns -1.
-- 
Thanks,
Anatoly
    
    
More information about the stable
mailing list