From 426723f979380f18f9c07d36ebac3a52f760ba7e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 5 Oct 2021 15:29:35 -0700 Subject: lib: Typechecking minmax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add typechecking to the min/max macros and make their locals truly unique-ish to reduce the risk of shadowing. v2: small bug fix, write also height coordinate on rotation test. (jheikkil) v3: Fix up a couple of other max/max_t instances (Ashutosh) Signed-off-by: Juha-Pekka Heikkilä Signed-off-by: Ashutosh Dixit Signed-off-by: Chris Wilson Reviewed-by: Zbigniew Kempczyński --- tools/intel_vbt_decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c index 625dc078..b063af84 100644 --- a/tools/intel_vbt_decode.c +++ b/tools/intel_vbt_decode.c @@ -534,10 +534,11 @@ static void dump_child_devices(struct context *context, const uint8_t *devices, * initialized to zero. */ child = calloc(1, sizeof(*child)); + igt_assert(child); for (i = 0; i < child_dev_num; i++) { memcpy(child, devices + i * child_dev_size, - min(sizeof(*child), child_dev_size)); + min_t(child_dev_size, sizeof(*child), child_dev_size)); dump_child_device(context, child); } -- cgit v1.2.3