diff options
| author | 2021-08-20 19:42:16 -0400 | |
|---|---|---|
| committer | 2021-09-14 15:57:09 -0400 | |
| commit | 5e1a9a3ed65a906481bea56eaae77a2ba01ef2b1 (patch) | |
| tree | 828dbc6b0cccce693042a7e1db2b7020dbae37c5 | |
| parent | drm/amd/display: Fix dynamic link encoder access. (diff) | |
drm/amd/display: Fix false BAD_FREE warning from Coverity
This is an attempt to fix false warning raised by Coverity
via multiple CID's.
Addresses-Coverity-ID: 1487412 ("Free of address-of expression")
Cc: Wesley Chalmers <Wesley.Chalmers@amd.com>
Reviewed-by: Wesley Chalmers <wesley.chalmers@amd.com>
Acked-by: Mikita Lipski <mikita.lipski@amd.com>
Signed-off-by: Anson Jacob <Anson.Jacob@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
| -rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c index 72970e49800a..7f25c11f4248 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c @@ -176,12 +176,15 @@ static void dpcd_reduce_address_range( uint8_t * const reduced_data, const uint32_t reduced_size) { - const uint32_t reduced_end_address = END_ADDRESS(reduced_address, reduced_size); - const uint32_t extended_end_address = END_ADDRESS(extended_address, extended_size); const uint32_t offset = reduced_address - extended_address; - if (extended_end_address == reduced_end_address && extended_address == reduced_address) - return; /* extended and reduced address ranges point to the same data */ + /* + * If the address is same, address was not extended. + * So we do not need to free any memory. + * The data is in original buffer(reduced_data). + */ + if (extended_data == reduced_data) + return; memcpy(&extended_data[offset], reduced_data, reduced_size); kfree(extended_data); |
