The following issues were found
drivers/gpu/drm/amd/display/dc/gpio/hw_gpio.h
1 issues
Line: 51
Column: 9
CWE codes:
362
struct hw_gpio_pin_funcs {
void (*destroy)(
struct hw_gpio_pin **ptr);
bool (*open)(
struct hw_gpio_pin *pin,
enum gpio_mode mode);
enum gpio_result (*get_value)(
const struct hw_gpio_pin *pin,
uint32_t *value);
Reported by FlawFinder.
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
1 issues
Line: 155
Column: 42
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
* OS/FW agnostic memcpy
*/
#ifndef dmub_memcpy
#define dmub_memcpy(dest, source, bytes) memcpy((dest), (source), (bytes))
#endif
/**
* OS/FW agnostic memset
*/
Reported by FlawFinder.
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
1 issues
Line: 34
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
uint8_t count = 0;
u8 bksv[sizeof(n)] = { };
memcpy(bksv, hdcp->auth.msg.hdcp1.bksv, sizeof(hdcp->auth.msg.hdcp1.bksv));
n = *(uint64_t *)bksv;
while (n) {
count++;
n &= (n - 1);
Reported by FlawFinder.
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c
1 issues
Line: 47
Column: 4
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
for (i = 0; i < msg_size; i++) {
if (i % bytes_per_line == 0)
buf[buf_pos++] = '\n';
sprintf(&buf[buf_pos], "%02X ", msg[i]);
buf_pos += byte_size;
}
buf[buf_pos++] = '\0';
}
}
Reported by FlawFinder.
crypto/lrw.c
1 issues
Line: 305
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 skcipher_instance *inst;
struct skcipher_alg *alg;
const char *cipher_name;
char ecb_name[CRYPTO_MAX_ALG_NAME];
u32 mask;
int err;
err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SKCIPHER, &mask);
if (err)
Reported by FlawFinder.
drivers/gpu/drm/amd/include/atom-bits.h
1 issues
Line: 30
Column: 23
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
static inline uint8_t get_u8(void *bios, int ptr)
{
return ((unsigned char *)bios)[ptr];
}
#define U8(ptr) get_u8(ctx->ctx->bios, (ptr))
#define CU8(ptr) get_u8(ctx->bios, (ptr))
static inline uint16_t get_u16(void *bios, int ptr)
{
Reported by FlawFinder.
crypto/jitterentropy-kcapi.c
1 issues
Line: 75
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
void jent_memcpy(void *dest, const void *src, unsigned int n)
{
memcpy(dest, src, n);
}
/*
* Obtain a high-resolution time stamp value. The time stamp is used to measure
* the execution time of a given code path and its variations. Hence, the time
Reported by FlawFinder.
drivers/gpu/drm/amd/include/kgd_pp_interface.h
1 issues
Line: 305
Column: 12
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
int (*check_state_equal)(void *handle,
void *cps,
void *rps,
bool *equal);
/* export for sysfs */
void (*set_fan_control_mode)(void *handle, u32 mode);
u32 (*get_fan_control_mode)(void *handle);
int (*set_fan_speed_percent)(void *handle, u32 speed);
int (*get_fan_speed_percent)(void *handle, u32 *speed);
Reported by FlawFinder.
drivers/gpu/drm/amd/pm/inc/hardwaremanager.h
1 issues
Line: 428
Column: 12
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
extern int phm_check_states_equal(struct pp_hwmgr *hwmgr,
const struct pp_hw_power_state *pstate1,
const struct pp_hw_power_state *pstate2,
bool *equal);
extern int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr,
const struct amd_pp_display_configuration *display_config);
extern int phm_get_dal_power_level(struct pp_hwmgr *hwmgr,
Reported by FlawFinder.
drivers/gpu/drm/amd/pm/inc/hwmgr.h
1 issues
Line: 292
Column: 12
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
int (*check_states_equal)(struct pp_hwmgr *hwmgr,
const struct pp_hw_power_state *pstate1,
const struct pp_hw_power_state *pstate2,
bool *equal);
int (*set_cpu_power_state)(struct pp_hwmgr *hwmgr);
int (*store_cc6_data)(struct pp_hwmgr *hwmgr, uint32_t separation_time,
bool cc6_disable, bool pstate_disable,
bool pstate_switch_disable);
int (*get_dal_power_level)(struct pp_hwmgr *hwmgr,
Reported by FlawFinder.