Skip to content

Commit

Permalink
module: make perm const
Browse files Browse the repository at this point in the history
Change the struct kernel_param.perm field to a const, as it should never
be changed.

Signed-off-by: Dan Streetman <[email protected]>
Signed-off-by: Rusty Russell <[email protected]> (cut from larger patch)
  • Loading branch information
ddstreet authored and rustyrussell committed Jun 23, 2015
1 parent 74c3dea commit 5104b7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/linux/moduleparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ enum {
struct kernel_param {
const char *name;
const struct kernel_param_ops *ops;
u16 perm;
const u16 perm;
s8 level;
u8 flags;
union {
Expand Down
8 changes: 3 additions & 5 deletions kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,11 @@ EXPORT_SYMBOL(param_ops_invbool);

int param_set_bint(const char *val, const struct kernel_param *kp)
{
struct kernel_param boolkp;
/* Match bool exactly, by re-using it. */
struct kernel_param boolkp = *kp;
bool v;
int ret;

/* Match bool exactly, by re-using it. */
boolkp = *kp;
boolkp.arg = &v;

ret = param_set_bool(val, &boolkp);
Expand Down Expand Up @@ -480,9 +479,8 @@ static int param_array_get(char *buffer, const struct kernel_param *kp)
{
int i, off, ret;
const struct kparam_array *arr = kp->arr;
struct kernel_param p;
struct kernel_param p = *kp;

p = *kp;
for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) {
if (i)
buffer[off++] = ',';
Expand Down

0 comments on commit 5104b7d

Please sign in to comment.