Now that every kernel_param_ops initializer in the tree goes through DEFINE_KERNEL_PARAM_OPS, no source file outside kernel/params.c and include/linux/moduleparam.h references the .get field by name. Take advantage of that to rename the field to .get_str.
The bare .get name is now free for the next commit, which adds it back as a struct seq_buf *-based callback. Signed-off-by: Kees Cook <[email protected]> --- include/linux/moduleparam.h | 8 ++++---- kernel/params.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 26bf45b36d02..f5f4148e2504 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -63,7 +63,7 @@ struct kernel_param_ops { /* Returns 0, or -errno. arg is in kp->arg. */ int (*set)(const char *val, const struct kernel_param *kp); /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ - int (*get)(char *buffer, const struct kernel_param *kp); + int (*get_str)(char *buffer, const struct kernel_param *kp); /* Optional function to free kp->arg when module unloaded. */ void (*free)(void *arg); }; @@ -82,7 +82,7 @@ struct kernel_param_ops { #define DEFINE_KERNEL_PARAM_OPS(_name, _set, _get) \ const struct kernel_param_ops _name = { \ .set = (_set), \ - .get = (_get), \ + .get_str = (_get), \ } /* As DEFINE_KERNEL_PARAM_OPS, with KERNEL_PARAM_OPS_FL_NOARG set. */ @@ -90,14 +90,14 @@ struct kernel_param_ops { const struct kernel_param_ops _name = { \ .flags = KERNEL_PARAM_OPS_FL_NOARG, \ .set = (_set), \ - .get = (_get), \ + .get_str = (_get), \ } /* As DEFINE_KERNEL_PARAM_OPS, with an additional .free callback. */ #define DEFINE_KERNEL_PARAM_OPS_FREE(_name, _set, _get, _free) \ const struct kernel_param_ops _name = { \ .set = (_set), \ - .get = (_get), \ + .get_str = (_get), \ .free = (_free), \ } diff --git a/kernel/params.c b/kernel/params.c index e19fff2926bc..6852caea1785 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -467,7 +467,7 @@ static int param_array_get(char *buffer, const struct kernel_param *kp) for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) { p.arg = arr->elem + arr->elemsize * i; check_kparam_locked(p.mod); - ret = arr->ops->get(elem_buf, &p); + ret = arr->ops->get_str(elem_buf, &p); if (ret < 0) goto out; ret = min(ret, (int)(PAGE_SIZE - 1 - off)); @@ -554,11 +554,11 @@ static ssize_t param_attr_show(const struct module_attribute *mattr, int count; const struct param_attribute *attribute = to_param_attr(mattr); - if (!attribute->param->ops->get) + if (!attribute->param->ops->get_str) return -EPERM; kernel_param_lock(mk->mod); - count = attribute->param->ops->get(buf, attribute->param); + count = attribute->param->ops->get_str(buf, attribute->param); kernel_param_unlock(mk->mod); return count; } -- 2.34.1
