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

Petri Latvala petri.latvala at intel.com
Wed Jan 16 11:20:33 UTC 2019


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 at intel.com>
Cc: Abdiel Janulgue <abdiel.janulgue at 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



More information about the igt-dev mailing list