drm/amd/display: Fix Coverity INTEGER_OVERFLOW within dal_gpio_service_create
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 08:56:25 +0000 (08:56 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 08:56:25 +0000 (08:56 +0000)
From Hersen Wu
313d3dd4ca0e898897f4255a4c1f3d9c1f400fe2 in linux-6.6.y/6.6.50
c6077aa66fa230d12f37fef01161ef080d13b726 in mainline linux

sys/dev/pci/drm/amd/display/dc/gpio/gpio_service.c

index 2f8ca83..f2037d7 100644 (file)
@@ -56,7 +56,7 @@ struct gpio_service *dal_gpio_service_create(
        struct dc_context *ctx)
 {
        struct gpio_service *service;
-       uint32_t index_of_id;
+       int32_t index_of_id;
 
        service = kzalloc(sizeof(struct gpio_service), GFP_KERNEL);
 
@@ -112,7 +112,7 @@ struct gpio_service *dal_gpio_service_create(
        return service;
 
 failure_2:
-       while (index_of_id) {
+       while (index_of_id > 0) {
                --index_of_id;
                kfree(service->busyness[index_of_id]);
        }