mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zpcictl: Replace strncpy() with util_strlcpy()
Use util_strlcpy() to copy log data correctly and get rid of the following GCC8 compile warning: zpcictl.c: In function ‘sclp_issue_action’: zpcictl.c:312:3: warning: ‘strncpy’ specified bound 4054 equals destination size [-Wstringop-truncation] strncpy(report.data.log_data, sdata, sizeof(report.data.log_data)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -309,7 +309,8 @@ static void sclp_issue_action(struct zpci_device *pdev, int action)
|
||||
if (pdev->class == PCI_CLASS_NVME)
|
||||
sdata = collect_smart_data(pdev);
|
||||
if (sdata) {
|
||||
strncpy(report.data.log_data, sdata, sizeof(report.data.log_data));
|
||||
util_strlcpy(report.data.log_data, sdata,
|
||||
sizeof(report.data.log_data));
|
||||
free(sdata);
|
||||
}
|
||||
sysfs_write_data(&report, pdev->slot);
|
||||
|
||||
Reference in New Issue
Block a user