summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2022-10-10 12:34:21 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-10-13 19:14:57 +0000
commitd6b6b2261667f0a4688fa0cf9f0699596d7efc93 (patch)
treed2f3a5f715f911dbfd8013c060c1c9b9ea8f5b99 /src/lib
parent5f69b867f0c9ec9c0afab4df70a3d0d06809957a (diff)
payloads,src: Replace ALIGN(x, a) by ALIGN_UP(x, a) for clarity
Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I80f3d2c90c58daa62651f6fd635c043b1ce38b84 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68255 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/bootmem.c2
-rw-r--r--src/lib/gcov-glue.c4
-rw-r--r--src/lib/malloc.c2
-rw-r--r--src/lib/rmodule.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/bootmem.c b/src/lib/bootmem.c
index 078f960932..ea971b6851 100644
--- a/src/lib/bootmem.c
+++ b/src/lib/bootmem.c
@@ -228,7 +228,7 @@ void *bootmem_allocate_buffer(size_t size)
}
/* 4KiB alignment. */
- size = ALIGN(size, 4096);
+ size = ALIGN_UP(size, 4096);
region = NULL;
memranges_each_entry(r, &bootmem) {
if (range_entry_base(r) >= max_addr)
diff --git a/src/lib/gcov-glue.c b/src/lib/gcov-glue.c
index 14f3e3ec3b..6bdb870195 100644
--- a/src/lib/gcov-glue.c
+++ b/src/lib/gcov-glue.c
@@ -37,7 +37,7 @@ static FILE *fopen(const char *path, const char *mode)
} else {
previous_file = current_file;
current_file =
- (FILE *)(ALIGN(((unsigned long)previous_file->data
+ (FILE *)(ALIGN_UP(((unsigned long)previous_file->data
+ previous_file->len), 16));
}
@@ -50,7 +50,7 @@ static FILE *fopen(const char *path, const char *mode)
current_file->filename = (char *)&current_file[1];
strcpy(current_file->filename, path);
current_file->data =
- (char *)ALIGN(((unsigned long)current_file->filename
+ (char *)ALIGN_UP(((unsigned long)current_file->filename
+ strlen(path) + 1), 16);
current_file->offset = 0;
current_file->len = 0;
diff --git a/src/lib/malloc.c b/src/lib/malloc.c
index 57a72c22c8..8ad038af5f 100644
--- a/src/lib/malloc.c
+++ b/src/lib/malloc.c
@@ -26,7 +26,7 @@ void *memalign(size_t boundary, size_t size)
MALLOCDBG("%s Enter, boundary %zu, size %zu, free_mem_ptr %p\n",
__func__, boundary, size, free_mem_ptr);
- free_mem_ptr = (void *)ALIGN((unsigned long)free_mem_ptr, boundary);
+ free_mem_ptr = (void *)ALIGN_UP((unsigned long)free_mem_ptr, boundary);
p = free_mem_ptr;
free_mem_ptr += size;
diff --git a/src/lib/rmodule.c b/src/lib/rmodule.c
index bee71d88ee..1446440e5a 100644
--- a/src/lib/rmodule.c
+++ b/src/lib/rmodule.c
@@ -222,7 +222,7 @@ static void *rmodule_cbfs_allocator(void *rsl_arg, size_t unused,
* to place the rmodule so that the program falls on the aligned
* address with the header just before it. Therefore, we need at least
* a page to account for the size of the header. */
- size_t region_size = ALIGN(memlen + region_alignment, 4096);
+ size_t region_size = ALIGN_UP(memlen + region_alignment, 4096);
/* The program starts immediately after the header. However,
* it needs to be aligned to a 4KiB boundary. Therefore, adjust the
* program location so that the program lands on a page boundary. The