[igt-dev] [PATCH i-g-t 04/21] lib/igt_kms: Use correct type for calloc

Petri Latvala
2019-01-16T11:21:02Z

The type mismatch was char vs. unsigned char, both being size 1 so
this didn't cause any actual issues other than noise in static
analysis that doesn't believe 1 is equal to another type of 1.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
lib/igt_kms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 684a599c..f926eafb 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1234,7 +1234,7 @@ init_cea_block(const unsigned char *edid, size_t length,

*new_length = length + 128;

- new_edid.data = calloc(*new_length, sizeof(char));
+ new_edid.data = calloc(*new_length, sizeof(*new_edid.data));
igt_assert_f(new_edid.data, "Failed to allocate %zu bytes for edid\n", sizeof(new_length));
memcpy(new_edid.data, edid, length);
*new_edid_ptr = new_edid.data;
--
2.19.1