drm/amd/display: fix type mismatch in CalculateDynamicMetadataParameters()

[ 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: 6725a88f88 ("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>
This commit is contained in:
Vitaliy Shevtsov
2025-02-27 01:28:51 +05:00
committed by Greg Kroah-Hartman
parent 32d12502d5
commit 1cabe832e7

View File

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