]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: Fix Coverity INTEGER_OVERFLOW within dal_gpio_service_create
authorHersen Wu <hersenxs.wu@amd.com>
Fri, 26 Apr 2024 15:58:11 +0000 (11:58 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Sep 2024 09:06:40 +0000 (11:06 +0200)
[ Upstream commit c6077aa66fa230d12f37fef01161ef080d13b726 ]

[Why]
For subtraction, coverity reports integer overflow
warning message when variable type is uint32_t.

[How]
Change variable type to int32_t.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c

index a7c92c64490c55a73f765812886e01bc521ee2e1..a5de27908914c7f5172945e88633973630f3afad 100644 (file)
@@ -58,7 +58,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);
 
@@ -114,7 +114,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]);
        }