[PATCH] drm/amd/powerplay: suppress KASAN out of bounds warning in vega10_populate_all_memory_levels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 06.11.2017 um 10:33 schrieb Evan Quan:
> Change-Id: I437e3e08cd48943de277c5d3eefdbaf21fd6a489
> Signed-off-by: Evan Quan <evan.quan at amd.com>

Tested-and-Acked-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> index 7079e61..0364a96 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> @@ -1807,6 +1807,10 @@ static int vega10_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
>   	mem_channels = (cgs_read_register(hwmgr->device, reg) &
>   			DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK) >>
>   			DF_CS_AON0_DramBaseAddress0__IntLvNumChan__SHIFT;
> +	PP_ASSERT_WITH_CODE(mem_channels < ARRAY_SIZE(channel_number),
> +			"Mem Channel Index Exceeded maximum!",
> +			return -1);
> +
>   	pp_table->NumMemoryChannels = cpu_to_le16(mem_channels);
>   	pp_table->MemoryChannelWidth =
>   			cpu_to_le16(HBM_MEMORY_CHANNEL_WIDTH *




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux