Skip to content

Commit a9156d7

Browse files
azeemshaikh38chucklever
authored andcommitted
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] KSPP/linux#89 [2] https://elixir.bootlin.com/linux/v6.4-rc6/source/include/linux/moduleparam.h#L52 Signed-off-by: Azeem Shaikh <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 6c53da5 commit a9156d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/sunrpc/svc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ param_get_pool_mode(char *buf, const struct kernel_param *kp)
109109
switch (*ip)
110110
{
111111
case SVC_POOL_AUTO:
112-
return strlcpy(buf, "auto\n", 20);
112+
return sysfs_emit(buf, "auto\n");
113113
case SVC_POOL_GLOBAL:
114-
return strlcpy(buf, "global\n", 20);
114+
return sysfs_emit(buf, "global\n");
115115
case SVC_POOL_PERCPU:
116-
return strlcpy(buf, "percpu\n", 20);
116+
return sysfs_emit(buf, "percpu\n");
117117
case SVC_POOL_PERNODE:
118-
return strlcpy(buf, "pernode\n", 20);
118+
return sysfs_emit(buf, "pernode\n");
119119
default:
120-
return sprintf(buf, "%d\n", *ip);
120+
return sysfs_emit(buf, "%d\n", *ip);
121121
}
122122
}
123123

0 commit comments

Comments
 (0)