]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: fix type mismatch in CalculateDynamicMetadataParameters()
authorVitaliy Shevtsov <v.shevtsov@mt-integration.ru>
Wed, 26 Feb 2025 20:28:51 +0000 (01:28 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:31:59 +0000 (14:31 +0200)
[ Upstream commit c3c584c18c90a024a54716229809ba36424f9660 ]

There is a type mismatch between what CalculateDynamicMetadataParameters()
takes and what is passed to it. Currently this function accepts several
args as signed long but it's called with unsigned integers and integer. On
some systems where long is 32 bits and one of these unsigned int params is
greater than INT_MAX it may cause passing input params as negative values.

Fix this by changing these argument types from long to unsigned int and to
int respectively. Also this will align the function's definition with
similar functions in other dcn* drivers.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Fixes: 6725a88f88a7 ("drm/amd/display: Add DCN3 DML")
Signed-off-by: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru>
Reviewed-by: Alex Hung <alex.hung@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/dml/dcn30/display_mode_vba_30.c

index de0fa87b301a5db0906f14533071fa488d694ad7..5c0d49d4eb8ecab3f72a7d194df0ed345c75ff0f 100644 (file)
@@ -283,10 +283,10 @@ static void CalculateDynamicMetadataParameters(
                double DISPCLK,
                double DCFClkDeepSleep,
                double PixelClock,
-               long HTotal,
-               long VBlank,
-               long DynamicMetadataTransmittedBytes,
-               long DynamicMetadataLinesBeforeActiveRequired,
+               unsigned int HTotal,
+               unsigned int VBlank,
+               unsigned int DynamicMetadataTransmittedBytes,
+               int DynamicMetadataLinesBeforeActiveRequired,
                int InterlaceEnable,
                bool ProgressiveToInterlaceUnitInOPP,
                double *Tsetup,
@@ -3375,8 +3375,8 @@ static double CalculateWriteBackDelay(
 
 
 static void CalculateDynamicMetadataParameters(int MaxInterDCNTileRepeaters, double DPPCLK, double DISPCLK,
-               double DCFClkDeepSleep, double PixelClock, long HTotal, long VBlank, long DynamicMetadataTransmittedBytes,
-               long DynamicMetadataLinesBeforeActiveRequired, int InterlaceEnable, bool ProgressiveToInterlaceUnitInOPP,
+               double DCFClkDeepSleep, double PixelClock, unsigned int HTotal, unsigned int VBlank, unsigned int DynamicMetadataTransmittedBytes,
+               int DynamicMetadataLinesBeforeActiveRequired, int InterlaceEnable, bool ProgressiveToInterlaceUnitInOPP,
                double *Tsetup, double *Tdmbf, double *Tdmec, double *Tdmsks)
 {
        double TotalRepeaterDelayTime = 0;