mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
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>
This commit is contained in:
parent
64d283cb37
commit
5e1a9a3ed6
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user