Skip to content

Commit 9f35e33

Browse files
ebiggerstorvalds
authored andcommitted
x86/its: Fix build errors when CONFIG_MODULES=n
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]>
1 parent 405e6c3 commit 9f35e33

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
@@ -133,7 +133,9 @@ static bool cfi_paranoid __ro_after_init;
133133

134134
#ifdef CONFIG_MITIGATION_ITS
135135

136+
#ifdef CONFIG_MODULES
136137
static struct module *its_mod;
138+
#endif
137139
static void *its_page;
138140
static unsigned int its_offset;
139141

@@ -171,6 +173,7 @@ static void *its_init_thunk(void *thunk, int reg)
171173
return thunk + offset;
172174
}
173175

176+
#ifdef CONFIG_MODULES
174177
void its_init_mod(struct module *mod)
175178
{
176179
if (!cpu_feature_enabled(X86_FEATURE_INDIRECT_THUNK_ITS))
@@ -209,6 +212,7 @@ void its_free_mod(struct module *mod)
209212
}
210213
kfree(mod->its_page_array);
211214
}
215+
#endif /* CONFIG_MODULES */
212216

213217
static void *its_alloc(void)
214218
{
@@ -217,6 +221,7 @@ static void *its_alloc(void)
217221
if (!page)
218222
return NULL;
219223

224+
#ifdef CONFIG_MODULES
220225
if (its_mod) {
221226
void *tmp = krealloc(its_mod->its_page_array,
222227
(its_mod->its_num_pages+1) * sizeof(void *),
@@ -229,6 +234,7 @@ static void *its_alloc(void)
229234

230235
execmem_make_temp_rw(page, PAGE_SIZE);
231236
}
237+
#endif /* CONFIG_MODULES */
232238

233239
return no_free_ptr(page);
234240
}

0 commit comments

Comments
 (0)