Skip to content

Commit 914dcaa

Browse files
committed
param: make param sections const.
Since this section can be read-only (they're in .rodata), they should always have been const. Minor flow-through various functions. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Tested-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
1 parent a105432 commit 914dcaa

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎include/linux/moduleparam.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ __check_old_set_param(int (*oldset)(const char *, struct kernel_param *))
161161
/* Called on module insert or kernel boot */
162162
extern int parse_args(const char *name,
163163
char *args,
164-
struct kernel_param *params,
164+
const struct kernel_param *params,
165165
unsigned num,
166166
int (*unknown)(char *param, char *val));
167167

‎init/main.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
201201
char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
202202
static const char *panic_later, *panic_param;
203203

204-
extern struct obs_kernel_param __setup_start[], __setup_end[];
204+
extern const struct obs_kernel_param __setup_start[], __setup_end[];
205205

206206
static int __init obsolete_checksetup(char *line)
207207
{
208-
struct obs_kernel_param *p;
208+
const struct obs_kernel_param *p;
209209
int had_early_param = 0;
210210

211211
p = __setup_start;
@@ -458,7 +458,7 @@ static noinline void __init_refok rest_init(void)
458458
/* Check for early params. */
459459
static int __init do_early_param(char *param, char *val)
460460
{
461-
struct obs_kernel_param *p;
461+
const struct obs_kernel_param *p;
462462

463463
for (p = __setup_start; p < __setup_end; p++) {
464464
if ((p->early && strcmp(param, p->str) == 0) ||
@@ -536,7 +536,7 @@ static void __init mm_init(void)
536536
asmlinkage void __init start_kernel(void)
537537
{
538538
char * command_line;
539-
extern struct kernel_param __start___param[], __stop___param[];
539+
extern const struct kernel_param __start___param[], __stop___param[];
540540

541541
smp_setup_processor_id();
542542

‎kernel/params.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static inline int parameq(const char *input, const char *paramname)
8888

8989
static int parse_one(char *param,
9090
char *val,
91-
struct kernel_param *params,
91+
const struct kernel_param *params,
9292
unsigned num_params,
9393
int (*handle_unknown)(char *param, char *val))
9494
{
@@ -170,7 +170,7 @@ static char *next_arg(char *args, char **param, char **val)
170170
/* Args looks like "foo=bar,bar2 baz=fuz wiz". */
171171
int parse_args(const char *name,
172172
char *args,
173-
struct kernel_param *params,
173+
const struct kernel_param *params,
174174
unsigned num,
175175
int (*unknown)(char *param, char *val))
176176
{

0 commit comments

Comments
 (0)