The following issues were found
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
1 issues
Line: 42
Column: 3
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
adev->nbio.ras_if->block = AMDGPU_RAS_BLOCK__PCIE_BIF;
adev->nbio.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
adev->nbio.ras_if->sub_block_index = 0;
strcpy(adev->nbio.ras_if->name, "pcie_bif");
}
ih_info.head = fs_info.head = *adev->nbio.ras_if;
r = amdgpu_ras_late_init(adev, adev->nbio.ras_if,
&fs_info, &ih_info);
if (r)
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
1 issues
Line: 1244
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return -EINVAL;
if (ubo->metadata_size)
memcpy(buffer, ubo->metadata, ubo->metadata_size);
}
if (flags)
*flags = ubo->metadata_flags;
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
1 issues
Line: 108
Column: 3
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
adev->sdma.ras_if->block = AMDGPU_RAS_BLOCK__SDMA;
adev->sdma.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
adev->sdma.ras_if->sub_block_index = 0;
strcpy(adev->sdma.ras_if->name, "sdma");
}
fs_info.head = ih_info->head = *adev->sdma.ras_if;
r = amdgpu_ras_late_init(adev, adev->sdma.ras_if,
&fs_info, ih_info);
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
1 issues
Line: 100
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
struct drm_device *dev = adev_to_drm(adev);
uint32_t phy_id;
uint32_t op;
char str[64];
int ret;
if (*pos || size > sizeof(str) - 1)
return -EINVAL;
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
1 issues
Line: 1448
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
if (!write) {
value = (value & mask) >> shift;
memcpy(buf, &value, bytes);
}
} else {
bytes = cursor.size & ~0x3ULL;
amdgpu_device_vram_access(adev, cursor.start,
(uint32_t *)buf, bytes,
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
1 issues
Line: 44
Column: 3
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
adev->umc.ras_if->block = AMDGPU_RAS_BLOCK__UMC;
adev->umc.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
adev->umc.ras_if->sub_block_index = 0;
strcpy(adev->umc.ras_if->name, "umc");
}
ih_info.head = fs_info.head = *adev->umc.ras_if;
r = amdgpu_ras_late_init(adev, adev->umc.ras_if,
&fs_info, &ih_info);
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
1 issues
Line: 143
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
/* header contains size and version */
struct amd_sriov_msg_vf2pf_info_header header;
/* driver version */
char driver_version[64];
/* driver certification, 1=WHQL, 0=None */
unsigned int driver_cert;
/* guest OS type and version: need a define */
unsigned int os_info;
/* in the unit of 1M */
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/atom.h
1 issues
Line: 146
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int io_mode;
uint32_t *scratch;
int scratch_size_bytes;
char vbios_version[20];
uint8_t name[STRLEN_LONG];
uint8_t vbios_pn[STRLEN_LONG];
uint32_t version;
uint8_t vbios_ver_str[STRLEN_NORMAL];
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
1 issues
Line: 70
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
num--;
if (num) {
if (buf) {
memcpy(&out, &buf[1], num);
} else {
DRM_ERROR("hw i2c: missing buf with num > 1\n");
r = -EINVAL;
goto done;
}
Reported by FlawFinder.
drivers/gpu/drm/amd/amdgpu/df_v3_6.c
1 issues
Line: 66
CWE codes:
758
spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
return (((ficadh_val & 0xFFFFFFFFFFFFFFFF) << 32) | ficadl_val);
}
static void df_v3_6_set_fica(struct amdgpu_device *adev, uint32_t ficaa_val,
uint32_t ficadl_val, uint32_t ficadh_val)
{
Reported by Cppcheck.