Commit a9156d7e authored by Azeem Shaikh's avatar Azeem Shaikh Committed by Chuck Lever

SUNRPC: Use sysfs_emit in place of strlcpy/sprintf

Part of an effort to remove strlcpy() tree-wide [1].

Direct replacement is safe here since the getter in kernel_params_ops
handles -errno return [2].

[1] https://github.com/KSPP/linux/issues/89
[2] https://elixir.bootlin.com/linux/v6.4-rc6/source/include/linux/moduleparam.h#L52Signed-off-by: default avatarAzeem Shaikh <azeemshaikh38@gmail.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 6c53da5d
...@@ -109,15 +109,15 @@ param_get_pool_mode(char *buf, const struct kernel_param *kp) ...@@ -109,15 +109,15 @@ param_get_pool_mode(char *buf, const struct kernel_param *kp)
switch (*ip) switch (*ip)
{ {
case SVC_POOL_AUTO: case SVC_POOL_AUTO:
return strlcpy(buf, "auto\n", 20); return sysfs_emit(buf, "auto\n");
case SVC_POOL_GLOBAL: case SVC_POOL_GLOBAL:
return strlcpy(buf, "global\n", 20); return sysfs_emit(buf, "global\n");
case SVC_POOL_PERCPU: case SVC_POOL_PERCPU:
return strlcpy(buf, "percpu\n", 20); return sysfs_emit(buf, "percpu\n");
case SVC_POOL_PERNODE: case SVC_POOL_PERNODE:
return strlcpy(buf, "pernode\n", 20); return sysfs_emit(buf, "pernode\n");
default: default:
return sprintf(buf, "%d\n", *ip); return sysfs_emit(buf, "%d\n", *ip);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment