Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm64: mm: Cast start/end markers to char *, not u64

There are a few memset() calls in map_kernel.c that cast marker-symbol
addresses to u64 in order to perform pointer subtraction (range size
computation).

Cast them with (char *) instead, aligning with idiomatic C pointer
arithmetic.

This patch provably has no effect at runtime: I have verified that
.text of vmlinux is identical after this change.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Sam Edwards and committed by
Will Deacon
030b3ffb 8f5ae30d

+3 -3
+3 -3
arch/arm64/kernel/pi/map_kernel.c
··· 179 179 * Don't bother with the FDT, we no longer need it after this. 180 180 */ 181 181 memset(init_idmap_pg_dir, 0, 182 - (u64)init_idmap_pg_end - (u64)init_idmap_pg_dir); 182 + (char *)init_idmap_pg_end - (char *)init_idmap_pg_dir); 183 183 184 184 create_init_idmap(init_idmap_pg_dir, mask); 185 185 dsb(ishst); ··· 188 188 set_ttbr0_for_lpa2((u64)init_idmap_pg_dir); 189 189 190 190 /* wipe the temporary ID map from memory */ 191 - memset(init_pg_dir, 0, (u64)init_pg_end - (u64)init_pg_dir); 191 + memset(init_pg_dir, 0, (char *)init_pg_end - (char *)init_pg_dir); 192 192 } 193 193 194 194 static void __init map_fdt(u64 fdt) ··· 242 242 map_fdt((u64)fdt); 243 243 244 244 /* Clear BSS and the initial page tables */ 245 - memset(__bss_start, 0, (u64)init_pg_end - (u64)__bss_start); 245 + memset(__bss_start, 0, (char *)init_pg_end - (char *)__bss_start); 246 246 247 247 /* Parse the command line for CPU feature overrides */ 248 248 chosen = fdt_path_offset(fdt, chosen_str);