Replace sprintf with snprintf in several files
Change-Id: I2a46433e81e605e57df4b2a1a9c1c27097333d0c Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
parent
228a81f1bc
commit
74da2fade4
@ -337,7 +337,7 @@ spdk_pci_device_get_serial_number(struct spdk_pci_device *dev, char *sn, size_t
|
|||||||
if (err)
|
if (err)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sprintf(sn, "%08x%08x", buf[1], buf[0]);
|
snprintf(sn, len, "%08x%08x", buf[1], buf[0]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,7 +404,8 @@ spdk_pci_device_claim(const struct spdk_pci_addr *pci_addr)
|
|||||||
.l_len = 0,
|
.l_len = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
sprintf(shm_name, PCI_PRI_FMT, pci_addr->domain, pci_addr->bus, pci_addr->dev, pci_addr->func);
|
snprintf(shm_name, sizeof(shm_name), PCI_PRI_FMT, pci_addr->domain, pci_addr->bus, pci_addr->dev,
|
||||||
|
pci_addr->func);
|
||||||
|
|
||||||
dev_fd = shm_open(shm_name, O_RDWR | O_CREAT, 0600);
|
dev_fd = shm_open(shm_name, O_RDWR | O_CREAT, 0600);
|
||||||
if (dev_fd == -1) {
|
if (dev_fd == -1) {
|
||||||
|
@ -80,7 +80,7 @@ config_file_fail_cases(void)
|
|||||||
|
|
||||||
section_index = 0;
|
section_index = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
sprintf(section_name, "Failure%d", section_index);
|
snprintf(section_name, sizeof(section_name), "Failure%d", section_index);
|
||||||
sp = spdk_conf_find_section(config, section_name);
|
sp = spdk_conf_find_section(config, section_name);
|
||||||
if (sp == NULL) {
|
if (sp == NULL) {
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user