}
#ifdef CONFIG_PPC_BARRIER_NOSPEC
+static bool is_fixup_addr_valid(void *dest, size_t size)
+{
+ return system_state < SYSTEM_FREEING_INITMEM ||
+ !init_section_contains(dest, size);
+}
+
static int do_patch_fixups(long *start, long *end, unsigned int *instrs, int num)
{
int i;
int j;
unsigned int *dest = (void *)start + *start;
+ if (!is_fixup_addr_valid(dest, sizeof(*instrs) * num))
+ continue;
+
pr_devel("patching dest %lx\n", (unsigned long)dest);
for (j = 0; j < num; j++)
for (i = 0; start < end; start++, i++) {
unsigned int *dest = (void *)start + *start;
+ if (!is_fixup_addr_valid(dest, sizeof(*instrs) * 3))
+ continue;
+
pr_devel("patching dest %lx\n", (unsigned long)dest);
// See comment in do_entry_flush_fixups() RE order of patching