Felix Kuehling
ab2f7a5c18
drm/amdgpu: Implement VRAM wipe on release
...
Wipe VRAM memory containing sensitive data when moving or releasing
BOs. Clearing the memory is pipelined to minimize any impact on
subsequent memory allocation latency. Use of a poison value should
help debug future use-after-free bugs.
When moving BOs, the existing ttm_bo_pipelined_move ensures that the
memory won't be reused before being wiped.
When releasing BOs, the BO is fenced with the memory fill operation,
which results in queuing the BO for a delayed delete.
v2: Move amdgpu_amdkfd_unreserve_memory_limit into
amdgpu_bo_release_notify so that KFD can use memory that's still
being cleared in the background
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-08-02 10:18:32 -05:00
Monk Liu
482f0e5385
drm/amdgpu: fix double ucode load by PSP(v3)
...
previously the ucode loading of PSP was repreated, one executed in
phase_1 init/re-init/resume and the other in fw_loading routine
Avoid this double loading by clearing ip_blocks.status.hw in suspend or reset
prior to the FW loading and any block's hw_init/resume
v2:
still do the smu fw loading since it is needed by bare-metal
v3:
drop the change in reinit_early_sriov, just clear all block's status.hw
in the head place and set the status.hw after hw_init done is enough
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Reviewed-by: Emily Deng <Emily.Deng@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-08-02 10:17:34 -05:00
Monk Liu
9244d3a6eb
drm/amdgpu: fix incorrect judge on sos fw version
...
for SRIOV the SOS fw of PSP is loaded in hypervisor thus
guest won't tell the version of it, and judging feature by
reading the sos fw version in guest side is completely wrong
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Reviewed-by: Emily Deng <Emily.Deng@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-08-02 10:17:28 -05:00
Monk Liu
4cd4c5c064
drm/amdgpu: cleanup vega10 SRIOV code path
...
we can simplify all those unnecessary function under
SRIOV for vega10 since:
1) PSP L1 policy is by force enabled in SRIOV
2) original logic always set all flags which make itself
a dummy step
besides,
1) the ih_doorbell_range set should also be skipped
for VEGA10 SRIOV.
2) the gfx_common registers should also be skipped
for VEGA10 SRIOV.
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Reviewed-by: Emily Deng <Emily.Deng@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-08-02 10:17:21 -05:00
Dave Airlie
4b381ee25d
Merge tag 'drm-fixes-5.3-2019-07-31' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
...
drm-fixes-5.3-2019-07-31:
amdgpu:
- Fix temperature granularity for navi
- Fix stable pstate setting for navi
- Fix VCN DPM enablement on navi
- Fix error handling on CS ioctl when processing dependencies
- Fix possible information leak in debugfs
amdkfd:
- fix memory alignment for VegaM
Signed-off-by: Dave Airlie <airlied@redhat.com >
From: Alex Deucher <alexdeucher@gmail.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20190731191648.25729-1-alexander.deucher@amd.com
2019-08-02 09:35:40 +10:00
Alex Deucher
9475a77b57
drm/amdkfd: enable KFD support for navi14
...
Same as navi10.
Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:51:26 -05:00
Dennis Li
dc4d716d4c
drm/amdgpu: disable inject for failed subblocks of gfx
...
some subblocks of gfx fail in inject test, disable them
Signed-off-by: Dennis Li <Dennis.Li@amd.com >
Reviewed-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:51:20 -05:00
Dennis Li
83b0582c90
drm/amdgpu: support gfx ras error injection and err_cnt query
...
check gfx error count in both ras querry function and
ras interrupt handler.
gfx ras is still disabled by default due to known stability
issue found in gpu reset.
Signed-off-by: Dennis Li <Dennis.Li@amd.com >
Reviewed-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:51:14 -05:00
Dennis Li
2c960ea02f
drm/amdgpu: add RAS callback for gfx
...
Add functions for RAS error inject and query error counter
Signed-off-by: Dennis Li <Dennis.Li@amd.com >
Reviewed-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:51:08 -05:00
Dennis Li
dc23a08f03
drm/amdgpu: add define for gfx ras subblock
...
Signed-off-by: Dennis Li <Dennis.Li@amd.com >
Reviewed-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:51:01 -05:00
Tao Zhou
7cdc2ee300
drm/amdgpu: remove ras_reserve_vram in ras injection
...
error injection address is not in gpu address space
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:50:41 -05:00
Tao Zhou
e10634938b
drm/amdgpu: add check for ras error type
...
only ue and ce errors are supported
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:50:35 -05:00
Tao Zhou
81e02619e9
drm/amdgpu: update interrupt callback for all ras clients
...
add err_data parameter in interrupt cb for ras clients
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:50:29 -05:00
Tao Zhou
cf04dfd0e9
drm/amdgpu: allow ras interrupt callback to return error data
...
add error data as parameter for ras interrupt cb and process it
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:50:23 -05:00
Tao Zhou
8c94810357
drm/amdgpu: query umc ras error address
...
query umc ras error address, translate it to gpu 4k page view
and save it.
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:50:17 -05:00
Tao Zhou
c2742aef4d
drm/amdgpu: add structures for umc error address translation
...
add related registers, callback function and channel index table
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:50:11 -05:00
Tao Zhou
6f102dba80
drm/amdgpu: add support for recording ras error address
...
more than one error address may be recorded in one query
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:50:05 -05:00
Tao Zhou
f1ed4afa13
drm/amdgpu: update algorithm of umc uncorrectable error counting
...
remove the check of ErrorCodeExt
v2: refine the if condition for ue counting
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:58 -05:00
Tao Zhou
045c021653
drm/amdgpu: switch to amdgpu_umc structure
...
create new amdgpu_umc structure to for more umc
settings in future and switch to the new structure
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:52 -05:00
Tao Zhou
5bbfb64a17
drm/amdgpu: use 64bit operation macros for umc
...
replace some 32bit macros with 64bit operations to simplify code
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:46 -05:00
Tao Zhou
4fa1c6a679
drm/amdgpu: add RREG64/WREG64(_PCIE) operations
...
add 64 bits register access functions
v2: implement 64 bit functions in low level
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:40 -05:00
Tao Zhou
05a58345db
drm/amdgpu: add ras error count after each query (v2)
...
v1: increase ras ce/ue error count
v2: log the number of correctable and uncorrectable errors
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:33 -05:00
Hawking Zhang
939e2258ce
drm/amdgpu: querry umc error count
...
check umc error count in both ras querry function and
ras interrupt handler
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:28 -05:00
Hawking Zhang
5b6b35aaac
drm/amdgpu: init umc v6_1 functions for vega20
...
init umc callback function for vega20 in sw early init phase
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:22 -05:00
Hawking Zhang
9884c2b1c3
drm/amdgpu: add umc v6_1 query error count support
...
Implement umc query_ras_error_count function to support querry
both correctable and uncorrectable error
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Tao Zhou <tao.zhou1@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:49:16 -05:00
Hawking Zhang
9e585a523b
drm/amdgpu: add amdgpu_umc_functions structure
...
This is common structure as UMC callback function
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:48:57 -05:00
Hawking Zhang
6501a77170
drm/amdgpu: init RSMU and UMC ip base address for vega20
...
the driver needs to program RSMU and UMC registers to
support vega20 RAS feature
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:48:51 -05:00
Hawking Zhang
7af25d5b7e
drm/amdgpu: move some ras data structure to amdgpu_ras.h
...
These are common structures that can be included by IP specific
source files
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Dennis Li <dennis.li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:48:32 -05:00
Alex Deucher
fa1884f9d8
drm/amdgpu: drop drmP.h from vcn_v2_5.c
...
Unused.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:33:41 -05:00
Alex Deucher
9a2ffeb525
drm/amdgpu: drop drmP.h from vcn_v2_0.c
...
And fix the fallout.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:33:36 -05:00
Alex Deucher
75589f496d
drm/amdgpu: drop drmP.h from sdma_v5_0.c
...
And fix the fallout.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:33:31 -05:00
Alex Deucher
e9eea90247
drm/amdgpu: drop drmP.h from nv.c
...
And fix up the fallout.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:33:26 -05:00
Alex Deucher
b23b2e9e49
drm/amdgpu: drop drmP.h from navi10_ih.c
...
And fix the fallout.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:33:21 -05:00
Alex Deucher
0a069bbe13
drm/amdgpu: drop drmP.h in gfx_v10_0.c
...
And fix the fallout.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:33:16 -05:00
Alex Deucher
3b90f6ecdf
drm/amdgpu: drop drmP.h from amdgpu_amdkfd_gfx_v10.c
...
Unused.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:33:10 -05:00
Alex Deucher
32978d8cfd
drm/amdgpu: drop drmP.h in amdgpu_amdkfd_arcturus.c
...
Unused.
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 14:32:56 -05:00
Andrzej Pietrasiewicz
5b50fa2b35
drm/amdgpu: Provide ddc symlink in connector sysfs directory
...
Use the ddc pointer provided by the generic connector.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com >
Acked-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Reviewed-by: Emil Velikov <emil.velikov@collabora.com >
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
Link: https://patchwork.freedesktop.org/patch/msgid/7fee0fa0d0f77af6595d283d5f3ae5d551475821.1564161140.git.andrzej.p@collabora.com
2019-07-31 16:35:37 +02:00
Daniel Vetter
b2ad978fd0
drm/amdgpu: Fill out gem_object->resv
...
That way we can ditch our gem_prime_res_obj implementation. Since ttm
absolutely needs the right reservation object all the boilerplate is
already there and we just have to wire it up correctly.
Note that gem/prime doesn't care when we do this, as long as we do it
before the bo is registered and someone can call the handle2fd ioctl
on it.
Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour
of always passing a non-NULL resv to ttm_bo_init(). At least for gem
drivers that would avoid having two of these, on in ttm_buffer_object
and the other in drm_gem_object, one just there for confusion.
Acked-by: Gerd Hoffmann <kraxel@redhat.com >
Cc: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Emil Velikov <emil.velikov@collabora.com >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Cc: Alex Deucher <alexander.deucher@amd.com >
Cc: "Christian König" <christian.koenig@amd.com >
Cc: Daniel Vetter <daniel.vetter@ffwll.ch >
Cc: "Michel Dänzer" <michel.daenzer@amd.com >
Cc: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Huang Rui <ray.huang@amd.com >
Cc: Felix Kuehling <Felix.Kuehling@amd.com >
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com >
Cc: Evan Quan <evan.quan@amd.com >
Cc: Sonny Jiang <sonny.jiang@amd.com >
Cc: Amber Lin <Amber.Lin@amd.com >
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl >
Cc: Junwei Zhang <Jerry.Zhang@amd.com >
Cc: Thomas Zimmermann <contact@tzimmermann.org >
Cc: Samuel Li <Samuel.Li@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20190725132655.11951-4-daniel.vetter@ffwll.ch
2019-07-31 10:19:23 +02:00
Evan Quan
6dee4829cf
drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval
...
VCN should be used for Vega20 later ASICs while UVD and VCE
are for previous ASICs.
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 02:02:22 -05:00
Wang Xiayang
929e571c04
drm/amdgpu: fix a potential information leaking bug
...
Coccinelle reports a path that the array "data" is never initialized.
The path skips the checks in the conditional branches when either
of callback functions, read_wave_vgprs and read_wave_sgprs, is not
registered. Later, the uninitialized "data" array is read
in the while-loop below and passed to put_user().
Fix the path by allocating the array with kcalloc().
The patch is simplier than adding a fall-back branch that explicitly
calls memset(data, 0, ...). Also it does not need the multiplication
1024*sizeof(*data) as the size parameter for memset() though there is
no risk of integer overflow.
Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 01:26:09 -05:00
Christian König
67d0859e27
drm/amdgpu: fix error handling in amdgpu_cs_process_fence_dep
...
We always need to drop the ctx reference and should check
for errors first and then dereference the fence pointer.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 01:26:09 -05:00
Evan Quan
479156f2e5
drm/amd/powerplay: fix null pointer dereference around dpm state relates
...
DPM state relates are not supported on the new SW SMU ASICs. But still
it's not OK to trigger null pointer dereference on accessing them.
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-31 00:06:58 -05:00
Kent Russell
d65848657c
drm/amdkfd: Fix byte align on VegaM
...
This was missed during the addition of VegaM support
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Kent Russell <kent.russell@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:59:00 -05:00
Hawking Zhang
861324983d
drm/amdgpu: correct irq type used for sdma ecc
...
we should pass irq type, instead of irq client id,
to irq_get/put interface
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:48:35 -05:00
Evan Quan
1f96ecef6f
drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval
...
VCN should be used for Vega20 later ASICs while UVD and VCE
are for previous ASICs.
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:48:34 -05:00
Le Ma
7d0e6329df
drm/amdgpu: update more sdma instances irq support
...
Update for sdma ras ecc_irq and other minors.
Signed-off-by: Le Ma <le.ma@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:48:34 -05:00
Evan Quan
7c16d24abe
drm/amdgpu: correct VCN powergate routine for acturus
...
Arcturus VCN should powergate in the way as Navi.
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Le Ma <Le.Ma@amd.com >
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:48:34 -05:00
Evan Quan
fe089e1dd7
drm/amd/powerplay: enable arcturus powerplay
...
Arcturus powerplay is ready to use.
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:48:33 -05:00
Evan Quan
cca4fafc09
drm/amd/powerplay: initialize arcturus MP1 and THM base address
...
Initialize base address for those IPs which are used in powerplay.
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:48:33 -05:00
Wang Xiayang
1a2c29bce0
drm/amdgpu: fix a potential information leaking bug
...
Coccinelle reports a path that the array "data" is never initialized.
The path skips the checks in the conditional branches when either
of callback functions, read_wave_vgprs and read_wave_sgprs, is not
registered. Later, the uninitialized "data" array is read
in the while-loop below and passed to put_user().
Fix the path by allocating the array with kcalloc().
The patch is simplier than adding a fall-back branch that explicitly
calls memset(data, 0, ...). Also it does not need the multiplication
1024*sizeof(*data) as the size parameter for memset() though there is
no risk of integer overflow.
Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2019-07-30 23:48:33 -05:00