PCI: endpoint: Use sysfs_emit() in "show" functions
Convert sprintf() in sysfs "show" functions to sysfs_emit() in order to check for buffer overruns in sysfs outputs. Link: https://lore.kernel.org/r/1630472957-26857-1-git-send-email-hayashi.kunihiko@socionext.com Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
This commit is contained in:
committed by
Lorenzo Pieralisi
parent
e4e737bb5c
commit
a2258831d1
@@ -1937,7 +1937,7 @@ static ssize_t epf_ntb_##_name##_show(struct config_item *item, \
|
||||
struct config_group *group = to_config_group(item); \
|
||||
struct epf_ntb *ntb = to_epf_ntb(group); \
|
||||
\
|
||||
return sprintf(page, "%d\n", ntb->_name); \
|
||||
return sysfs_emit(page, "%d\n", ntb->_name); \
|
||||
}
|
||||
|
||||
#define EPF_NTB_W(_name) \
|
||||
@@ -1968,7 +1968,7 @@ static ssize_t epf_ntb_##_name##_show(struct config_item *item, \
|
||||
\
|
||||
sscanf(#_name, "mw%d", &win_no); \
|
||||
\
|
||||
return sprintf(page, "%lld\n", ntb->mws_size[win_no - 1]); \
|
||||
return sysfs_emit(page, "%lld\n", ntb->mws_size[win_no - 1]); \
|
||||
}
|
||||
|
||||
#define EPF_NTB_MW_W(_name) \
|
||||
|
||||
Reference in New Issue
Block a user