Skip to content

Commit bb85c3a

Browse files
ebiggersgregkh
authored andcommitted
x86/its: Fix build errors when CONFIG_MODULES=n
commit 9f35e33 upstream. Fix several build errors when CONFIG_MODULES=n, including the following: ../arch/x86/kernel/alternative.c:195:25: error: incomplete definition of type 'struct module' 195 | for (int i = 0; i < mod->its_num_pages; i++) { Fixes: 872df34 ("x86/its: Use dynamic thunks for indirect branches") Cc: [email protected] Signed-off-by: Eric Biggers <[email protected]> Acked-by: Dave Hansen <[email protected]> Tested-by: Steven Rostedt (Google) <[email protected]> Reviewed-by: Alexandre Chartre <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2a6194e commit bb85c3a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/x86/kernel/alternative.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ const unsigned char * const x86_nops[ASM_NOP_MAX+1] =
129129

130130
#ifdef CONFIG_MITIGATION_ITS
131131

132+
#ifdef CONFIG_MODULES
132133
static struct module *its_mod;
134+
#endif
133135
static void *its_page;
134136
static unsigned int its_offset;
135137

@@ -150,6 +152,7 @@ static void *its_init_thunk(void *thunk, int reg)
150152
return thunk;
151153
}
152154

155+
#ifdef CONFIG_MODULES
153156
void its_init_mod(struct module *mod)
154157
{
155158
if (!cpu_feature_enabled(X86_FEATURE_INDIRECT_THUNK_ITS))
@@ -188,6 +191,7 @@ void its_free_mod(struct module *mod)
188191
}
189192
kfree(mod->its_page_array);
190193
}
194+
#endif /* CONFIG_MODULES */
191195

192196
static void *its_alloc(void)
193197
{
@@ -196,6 +200,7 @@ static void *its_alloc(void)
196200
if (!page)
197201
return NULL;
198202

203+
#ifdef CONFIG_MODULES
199204
if (its_mod) {
200205
void *tmp = krealloc(its_mod->its_page_array,
201206
(its_mod->its_num_pages+1) * sizeof(void *),
@@ -206,6 +211,7 @@ static void *its_alloc(void)
206211
its_mod->its_page_array = tmp;
207212
its_mod->its_page_array[its_mod->its_num_pages++] = page;
208213
}
214+
#endif /* CONFIG_MODULES */
209215

210216
return no_free_ptr(page);
211217
}

0 commit comments

Comments
 (0)