Commit 10ac5402 authored by Joe Perches's avatar Joe Perches Committed by Yongqiang Liu
Browse files

drivers core: Miscellaneous changes for sysfs_emit

mainline inclusion
from mainline-v5.10-rc1
commit 948b3edb
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I5C32F


CVE: CVE-2022-20166

--------------------------------------------------

Change additional instances that could use sysfs_emit and sysfs_emit_at
that the coccinelle script could not convert.

o macros creating show functions with ## concatenation
o unbound sprintf uses with buf+len for start of output to sysfs_emit_at
o returns with ?: tests and sprintf to sysfs_emit
o sysfs output with struct class * not struct device * arguments

Miscellanea:

o remove unnecessary initializations around these changes
o consistently use int len for return length of show functions
o use octal permissions and not S_<FOO>
o rename a few show function names so DEVICE_ATTR_<FOO> can be used
o use DEVICE_ATTR_ADMIN_RO where appropriate
o consistently use const char *output for strings
o checkpatch/style neatening

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Link: https://lore.kernel.org/r/8bc24444fe2049a9b2de6127389b57edfdfe324d.1600285923.git.joe@perches.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Conflicts:
	drivers/base/bus.c
	drivers/base/core.c
	drivers/base/cpu.c
	drivers/base/dd.c
	drivers/base/memory.c
	drivers/base/node.c
    drivers/base/platform.c
    drivers/base/power/sysfs.c
    drivers/base/soc.c

Signed-off-by: default avatarGuo Mengqi <guomengqi3@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 9b7039a0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment