From: Alan Tull <at...@kernel.org> commit f625bc5635d156f683d95077267484ce7554b5b6 from https://github.com/altera-opensource/linux-socfpga.git
Klocwork give the following complaints: /home/yves/linux/intel/linux-socfpga/drivers/fpga/fpga-bridge.c:243 -- -- SV.BANNED.REQUIRED.SPRINTF (4:Review) Analyze Function 'sprintf' is deprecated. Replace with more secure equivalent like 'sprintf_s', add missing logic, or re-architect. /home/yves/linux/intel/linux-socfpga/drivers/fpga/fpga-bridge.c:255 -- -- SV.BANNED.REQUIRED.SPRINTF (4:Review) Analyze Function 'sprintf' is deprecated. Replace with more secure equivalent like 'sprintf_s', add missing logic, or re-architect. Remedy these by using scnprintf rather than sprintf. Signed-off-by: Alan Tull <at...@kernel.org> Signed-off-by: Meng Li <meng...@windriver.com> --- drivers/fpga/fpga-bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c index 9651aa5..868adcb 100644 --- a/drivers/fpga/fpga-bridge.c +++ b/drivers/fpga/fpga-bridge.c @@ -240,7 +240,7 @@ static ssize_t name_show(struct device *dev, { struct fpga_bridge *bridge = to_fpga_bridge(dev); - return sprintf(buf, "%s\n", bridge->name); + return scnprintf(buf, PAGE_SIZE, "%s\n", bridge->name); } static ssize_t state_show(struct device *dev, @@ -252,7 +252,7 @@ static ssize_t state_show(struct device *dev, if (bridge->br_ops && bridge->br_ops->enable_show) enable = bridge->br_ops->enable_show(bridge); - return sprintf(buf, "%s\n", enable ? "enabled" : "disabled"); + return scnprintf(buf, 10, "%s\n", enable ? "enabled" : "disabled"); } static DEVICE_ATTR_RO(name); -- 1.7.9.5 -- _______________________________________________ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto