diff options
author | Brian Starkey <brian.starkey@arm.com> | 2017-06-05 14:28:40 +0100 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2017-06-09 15:30:17 +0300 |
commit | 09e666d2396c4d0df362809bf5498ab61079d11e (patch) | |
tree | ebd5fac61dc2f0ce33420362b719b1ade8ec5a8d /lib/igt_debugfs.c | |
parent | 4bdcd335961203c07a37aaebf6c441814a6555fa (diff) |
lib/igt_debugfs: Only use valid values in igt_crc_to_str()
Not all elements in the crc array may be valid, so only use the valid
ones to generate the string.
Signed-off-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/igt_debugfs.c')
-rw-r--r-- | lib/igt_debugfs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index f5ed3daf..80f25c61 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -312,10 +312,11 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b) */ char *igt_crc_to_string(igt_crc_t *crc) { - char buf[128]; + int i; + char buf[128] = { 0 }; - sprintf(buf, "%08x %08x %08x %08x %08x", crc->crc[0], - crc->crc[1], crc->crc[2], crc->crc[3], crc->crc[4]); + for (i = 0; i < crc->n_words; i++) + sprintf(buf + strlen(buf), "%08x ", crc->crc[i]); return strdup(buf); } |