mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
drm/amdgpu: fix a signedness bug in __verify_ras_table_checksum()
If amdgpu_eeprom_read() returns a negative error code then the error
handling checks:
if (res < buf_size) {
The problem is that "buf_size" is a u32 so negative values are type
promoted to a high positive values and the condition is false. Fix
this by changing the type of "buf_size" to int.
Fixes: 63d4c081a5 ("drm/amdgpu: Optimize EEPROM RAS table I/O")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
7b101c9548
commit
3006c92455
|
|
@ -978,9 +978,8 @@ const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops = {
|
|||
static int __verify_ras_table_checksum(struct amdgpu_ras_eeprom_control *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
int res;
|
||||
int buf_size, res;
|
||||
u8 csum, *buf, *pp;
|
||||
u32 buf_size;
|
||||
|
||||
buf_size = RAS_TABLE_HEADER_SIZE +
|
||||
control->ras_num_recs * RAS_TABLE_RECORD_SIZE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user