Skip to contentSkip to conversation

s390/mm: Fix type mismatch in get_align_mask().

PATCH In review Gerald Schaefer 2 participants 2 messages Jun 30 – Jul 1

Subsystems (2)
lore
Share & tools
lore

Gerald Schaefer

author maintainer
#0 lore raw

PATCH 1/1 s390/mm: Fix type mismatch in get_align_mask().

Commit 86f48f922ba79 ("s390/mmap: disable mmap alignment when randomize_va_space = 0") introduced get_align_mask() with return type of 'int', while the target field 'info.align_mask' in struct vm_unmapped_area_info is 'unsigned long'.

With currently used masks, this should not cause truncation issues, but fix it and return 'unsigned long' to avoid future problems.

Fixes 86f48f922ba79 ("s390/mmap: disable mmap alignment when randomize_va_space = 0")
---
 arch/s390/mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/mm/mmap.c +1 -1
index 2a222a7e14f4..ef7bfc87758c 100644
@@ -64,7 +64,7 @@ static inline unsigned long mmap_base(unsigned long rnd,
 	return PAGE_ALIGN(STACK_TOP - gap - rnd);
 }
 
-static int get_align_mask(struct file *filp, unsigned long flags)
+static unsigned long get_align_mask(struct file *filp, unsigned long flags)
 {
 	if (filp && is_file_hugepages(filp))
 		return huge_page_mask_align(filp);

base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482

Signature · 1 line
2.53.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Gerald Schaefer

Commit 86f48f922ba79 ("s390/mmap: disable mmap alignment when randomize_va_space = 0") introduced get_align_mask() with return type of 'int', while the target field 'info.align_mask' in struct vm_unmapped_area_info is 'unsigned long'.

With currently used masks, this should not cause truncation issues, but fix it and return 'unsigned long' to avoid future problems.

Fixes 86f48f922ba79 ("s390/mmap: disable mmap alignment when randomize_va_space = 0")
---
 arch/s390/mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/mm/mmap.c +1 -1
index 2a222a7e14f4..ef7bfc87758c 100644
@@ -64,7 +64,7 @@ static inline unsigned long mmap_base(unsigned long rnd,
 	return PAGE_ALIGN(STACK_TOP - gap - rnd);
 }
 
-static int get_align_mask(struct file *filp, unsigned long flags)
+static unsigned long get_align_mask(struct file *filp, unsigned long flags)
 {
 	if (filp && is_file_hugepages(filp))
 		return huge_page_mask_align(filp);
Quoted 1 line

base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482