Skip to content

Commit a406dde

Browse files
committed
Fix node_list_rm_first() and node_list_rm_with_alignment()
Fix checking alignment in the following functions of the coarse library: - node_list_rm_first() and - node_list_rm_with_alignment() In order to check the alignment we have to verify an address of the block (block->data), not a size (block->size) of course ... Signed-off-by: Lukasz Dorau <[email protected]>
1 parent f36d893 commit a406dde

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/coarse/coarse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2024 Intel Corporation
2+
* Copyright (C) 2024-2025 Intel Corporation
33
*
44
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -278,7 +278,7 @@ static block_t *node_list_rm_first(ravl_free_blocks_head_t *head_node,
278278
assert(node->prev == NULL);
279279
struct block_t *block = node->block;
280280

281-
if (IS_NOT_ALIGNED(block->size, alignment)) {
281+
if (IS_NOT_ALIGNED(((uintptr_t)block->data), alignment)) {
282282
return NULL;
283283
}
284284

@@ -303,7 +303,7 @@ static block_t *node_list_rm_with_alignment(ravl_free_blocks_head_t *head_node,
303303

304304
ravl_free_blocks_elem_t *node;
305305
for (node = head_node->head; node != NULL; node = node->next) {
306-
if (IS_ALIGNED(node->block->size, alignment)) {
306+
if (IS_ALIGNED(((uintptr_t)node->block->data), alignment)) {
307307
return node_list_rm(head_node, node);
308308
}
309309
}

0 commit comments

Comments
 (0)