The data type of sprintf called in the function uuid_le() is mismatch. Arm64 compiler force it to unsigned char by default, and can work normally. But if someone compile it with the option -fsigned-char, the function can't work correctly.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- ras-extlog-handler.c | 2 +- ras-non-standard-handler.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ras-extlog-handler.c b/ras-extlog-handler.c index 5fd3580..1834687 100644 --- a/ras-extlog-handler.c +++ b/ras-extlog-handler.c @@ -152,7 +152,7 @@ static char *uuid_le(const char *uu) static const unsigned char le[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
for (i = 0; i < 16; i++) { - p += sprintf(p, "%.2x", uu[le[i]]); + p += sprintf(p, "%.2x", (unsigned char) uu[le[i]]); switch (i) { case 3: case 5: diff --git a/ras-non-standard-handler.c b/ras-non-standard-handler.c index 6ccf5bc..6d5a6f8 100644 --- a/ras-non-standard-handler.c +++ b/ras-non-standard-handler.c @@ -36,7 +36,7 @@ static char *uuid_le(const char *uu) static const unsigned char le[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
for (i = 0; i < 16; i++) { - p += sprintf(p, "%.2x", uu[le[i]]); + p += sprintf(p, "%.2x", (unsigned char) uu[le[i]]); switch (i) { case 3: case 5: @@ -61,7 +61,7 @@ static int uuid_le_cmp(const char *sec_type, const char *uuid2) 3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15};
for (i = 0; i < 16; i++) - p += sprintf(p, "%.2x", sec_type[le[i]]); + p += sprintf(p, "%.2x", (unsigned char) sec_type[le[i]]); *p = 0; return strncmp(uuid1, uuid2, 32); }