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
..
2019-06-14 11:44:24 +02:00
2019-06-14 11:44:24 +02:00
2019-06-14 11:44:24 +02:00
2019-06-14 11:44:24 +02:00
2019-06-20 11:36:22 -05:00
2019-06-20 11:36:22 -05:00
2019-07-18 14:18:07 -05:00
2019-06-19 12:07:29 +02:00
2019-06-19 12:07:29 +02:00
2017-10-20 13:28:44 -04:00
2019-01-14 10:58:37 +01:00
2019-06-10 23:00:01 +02:00
2019-06-22 09:34:14 -05:00
2019-06-14 11:44:24 +02:00
2019-07-18 14:18:04 -05:00
2019-06-20 21:16:38 -05:00
2019-06-14 11:44:24 +02:00
2019-06-14 11:44:24 +02:00
2019-06-19 12:07:29 +02:00
2019-06-14 11:44:24 +02:00
2019-06-14 11:44:24 +02:00