57 lines
1.4 KiB
Diff
57 lines
1.4 KiB
Diff
From 726b641b0dd842b920f7e1c985cb4a22494fe466 Mon Sep 17 00:00:00 2001
|
|
From: Martin Mares <mj@ucw.cz>
|
|
Date: Sat, 25 Jan 2020 20:42:03 +0100
|
|
Subject: [PATCH] VPD: When printing item IDs, escape non-ASCII characters
|
|
|
|
References: bsc#1170554 ltc#185587
|
|
Upstream: v3.6.4
|
|
Git-commit: 726b641b0dd842b920f7e1c985cb4a22494fe466
|
|
|
|
---
|
|
ls-vpd.c | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/ls-vpd.c b/ls-vpd.c
|
|
index 37217f0..92627e4 100644
|
|
--- a/ls-vpd.c
|
|
+++ b/ls-vpd.c
|
|
@@ -10,6 +10,7 @@
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
+#include <string.h>
|
|
|
|
#include "lspci.h"
|
|
|
|
@@ -156,13 +157,14 @@ cap_vpd(struct device *d)
|
|
{
|
|
word read_len;
|
|
const struct vpd_item *item;
|
|
- byte id1, id2;
|
|
+ byte id[2], id1, id2;
|
|
|
|
if (!read_vpd(d, res_addr + part_pos, buf, 3, &csum))
|
|
break;
|
|
part_pos += 3;
|
|
- id1 = buf[0];
|
|
- id2 = buf[1];
|
|
+ memcpy(id, buf, 2);
|
|
+ id1 = id[0];
|
|
+ id2 = id[1];
|
|
part_len = buf[2];
|
|
if (part_len > res_len - part_pos)
|
|
break;
|
|
@@ -178,7 +180,9 @@ cap_vpd(struct device *d)
|
|
if (!read_vpd(d, res_addr + part_pos, buf, read_len, &csum))
|
|
break;
|
|
|
|
- printf("\t\t\t[%c%c] %s: ", id1, id2, item->name);
|
|
+ printf("\t\t\t[");
|
|
+ print_vpd_string(id, 2);
|
|
+ printf("] %s: ", item->name);
|
|
|
|
switch (item->format)
|
|
{
|
|
--
|
|
2.26.2
|
|
|