nvme/identify: print ASCII strings with helper
SN, MN, and FR are ASCII strings as defined by the NVMe spec; use the new print_ascii_string() helper function to print them. This trims the trailing spaces and prevents accidentally printing any control characters to the screen if the device provides an invalid ASCII string. Change-Id: Ifaf383a79e13be62625250e7e79a305ebaa3612b Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/405926 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
8e56cd4131
commit
7b4bc2a243
@ -643,12 +643,15 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
|
|||||||
printf("================================\n");
|
printf("================================\n");
|
||||||
printf("Vendor ID: %04x\n", cdata->vid);
|
printf("Vendor ID: %04x\n", cdata->vid);
|
||||||
printf("Subsystem Vendor ID: %04x\n", cdata->ssvid);
|
printf("Subsystem Vendor ID: %04x\n", cdata->ssvid);
|
||||||
snprintf(str, sizeof(cdata->sn) + 1, "%s", cdata->sn);
|
printf("Serial Number: ");
|
||||||
printf("Serial Number: %s\n", str);
|
print_ascii_string(cdata->sn, sizeof(cdata->sn));
|
||||||
snprintf(str, sizeof(cdata->mn) + 1, "%s", cdata->mn);
|
printf("\n");
|
||||||
printf("Model Number: %s\n", str);
|
printf("Model Number: ");
|
||||||
snprintf(str, sizeof(cdata->fr) + 1, "%s", cdata->fr);
|
print_ascii_string(cdata->mn, sizeof(cdata->mn));
|
||||||
printf("Firmware Version: %s\n", str);
|
printf("\n");
|
||||||
|
printf("Firmware Version: ");
|
||||||
|
print_ascii_string(cdata->fr, sizeof(cdata->fr));
|
||||||
|
printf("\n");
|
||||||
printf("Recommended Arb Burst: %d\n", cdata->rab);
|
printf("Recommended Arb Burst: %d\n", cdata->rab);
|
||||||
printf("IEEE OUI Identifier: %02x %02x %02x\n",
|
printf("IEEE OUI Identifier: %02x %02x %02x\n",
|
||||||
cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]);
|
cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]);
|
||||||
|
Loading…
Reference in New Issue
Block a user