Re: [PATCH v2] mem-pool: fix big allocations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi René

On 28/12/2023 19:19, René Scharfe wrote:
Interdiff against v1:
   diff --git a/t/unit-tests/t-mem-pool.c b/t/unit-tests/t-mem-pool.c
   index 2295779b0b..a0d57df761 100644
   --- a/t/unit-tests/t-mem-pool.c
   +++ b/t/unit-tests/t-mem-pool.c
   @@ -1,8 +1,6 @@
    #include "test-lib.h"
    #include "mem-pool.h"

   -#define check_ptr(a, op, b) check_int(((a) op (b)), ==, 1)
   -
    static void setup_static(void (*f)(struct mem_pool *), size_t block_alloc)
    {
    	struct mem_pool pool = { .block_alloc = block_alloc };
   @@ -16,11 +14,10 @@ static void t_calloc_100(struct mem_pool *pool)
    	char *buffer = mem_pool_calloc(pool, 1, size);
    	for (size_t i = 0; i < size; i++)
    		check_int(buffer[i], ==, 0);
   -	if (!check_ptr(pool->mp_block, !=, NULL))
   +	if (!check(pool->mp_block != NULL))
    		return;
   -	check_ptr(pool->mp_block->next_free, <=, pool->mp_block->end);
   -	check_ptr(pool->mp_block->next_free, !=, NULL);
   -	check_ptr(pool->mp_block->end, !=, NULL);
   +	check(pool->mp_block->next_free != NULL);
   +	check(pool->mp_block->end != NULL);
    }

The changes to the unit tests look good to me (I haven't really looked at the actual bug fix in the mem_pool code).

Best Wishes

Phillip




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux