The following issues were found
drivers/firmware/scpi_pm_domain.c
2 issues
Line: 19
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 generic_pm_domain genpd;
struct scpi_ops *ops;
u32 domain;
char name[30];
};
/*
* These device power state values are not well-defined in the specification.
* In case, different implementations use different values, we can make these
Reported by FlawFinder.
Line: 113
Column: 3
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
scpi_pd->domain = i;
scpi_pd->ops = scpi_ops;
sprintf(scpi_pd->name, "%pOFn.%d", np, i);
scpi_pd->genpd.name = scpi_pd->name;
scpi_pd->genpd.power_off = scpi_pd_power_off;
scpi_pd->genpd.power_on = scpi_pd_power_on;
/*
Reported by FlawFinder.
drivers/acpi/osi.c
2 issues
Line: 26
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
#define OSI_STRING_ENTRIES_MAX 16
struct acpi_osi_entry {
char string[OSI_STRING_LENGTH_MAX];
bool enable;
};
static struct acpi_osi_config {
u8 default_disabling;
Reported by FlawFinder.
Line: 137
Column: 4
CWE codes:
120
break;
} else if (osi->string[0] == '\0') {
osi->enable = enable;
strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
break;
}
}
}
Reported by FlawFinder.
drivers/acpi/acpica/dbcmds.c
2 issues
Line: 1115
Column: 3
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
return;
}
strcpy(acpi_db_trace_method_name, method_arg);
}
if (!strcmp(enable_arg, "ENABLE") ||
!strcmp(enable_arg, "METHOD") || !strcmp(enable_arg, "OPCODE")) {
if (!strcmp(enable_arg, "ENABLE")) {
Reported by FlawFinder.
Line: 1108
Column: 21
CWE codes:
126
}
acpi_db_trace_method_name =
ACPI_ALLOCATE(strlen(method_arg) + 1);
if (!acpi_db_trace_method_name) {
acpi_os_printf("Failed to allocate method name (%s)\n",
method_arg);
return;
}
Reported by FlawFinder.
drivers/crypto/gemini/sl3516-ce-rng.c
2 issues
drivers/clk/versatile/clk-sp810.c
2 issues
Line: 85
Column: 8
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 void __init clk_sp810_of_setup(struct device_node *node)
{
struct clk_sp810 *sp810 = kzalloc(sizeof(*sp810), GFP_KERNEL);
const char *parent_names[2];
int num = ARRAY_SIZE(parent_names);
char name[12];
struct clk_init_data init;
static int instance;
int i;
Reported by FlawFinder.
Line: 87
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 clk_sp810 *sp810 = kzalloc(sizeof(*sp810), GFP_KERNEL);
const char *parent_names[2];
int num = ARRAY_SIZE(parent_names);
char name[12];
struct clk_init_data init;
static int instance;
int i;
bool deprecated;
Reported by FlawFinder.
drivers/crypto/geode-aes.c
2 issues
Line: 118
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
tctx->keylen = len;
if (len == AES_KEYSIZE_128) {
memcpy(tctx->key, key, len);
return 0;
}
if (len != AES_KEYSIZE_192 && len != AES_KEYSIZE_256)
/* not supported at all */
Reported by FlawFinder.
Line: 144
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
tctx->keylen = len;
if (len == AES_KEYSIZE_128) {
memcpy(tctx->key, key, len);
return 0;
}
if (len != AES_KEYSIZE_192 && len != AES_KEYSIZE_256)
/* not supported at all */
Reported by FlawFinder.
drivers/acpi/nvs.c
2 issues
Line: 191
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
suspend_nvs_free();
return -ENOMEM;
}
memcpy(entry->data, entry->kaddr, entry->size);
}
return 0;
}
Reported by FlawFinder.
Line: 211
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
list_for_each_entry(entry, &nvs_list, node)
if (entry->data)
memcpy(entry->kaddr, entry->data, entry->size);
}
#endif
Reported by FlawFinder.
crypto/chacha_generic.c
2 issues
Line: 62
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
subctx.nrounds = ctx->nrounds;
/* Build the real IV */
memcpy(&real_iv[0], req->iv + 24, 8); /* stream position */
memcpy(&real_iv[8], req->iv + 16, 8); /* remaining 64 nonce bits */
/* Generate the stream and XOR it with the data */
return chacha_stream_xor(req, &subctx, real_iv);
}
Reported by FlawFinder.
Line: 63
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/* Build the real IV */
memcpy(&real_iv[0], req->iv + 24, 8); /* stream position */
memcpy(&real_iv[8], req->iv + 16, 8); /* remaining 64 nonce bits */
/* Generate the stream and XOR it with the data */
return chacha_stream_xor(req, &subctx, real_iv);
}
Reported by FlawFinder.
drivers/acpi/acpi_pnp.c
2 issues
Line: 322
Column: 6
CWE codes:
126
{
int i;
if (strlen(idstr) != strlen(list_id))
return false;
if (memcmp(idstr, list_id, 3))
return false;
Reported by FlawFinder.
Line: 322
Column: 23
CWE codes:
126
{
int i;
if (strlen(idstr) != strlen(list_id))
return false;
if (memcmp(idstr, list_id, 3))
return false;
Reported by FlawFinder.
drivers/acpi/acpi_pad.c
2 issues
Line: 429
Column: 2
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
{
acpi_status status;
strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PROCESSOR_AGGREGATOR_CLASS);
if (acpi_pad_add_sysfs(device))
return -ENODEV;
Reported by FlawFinder.
Line: 430
Column: 2
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
acpi_status status;
strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PROCESSOR_AGGREGATOR_CLASS);
if (acpi_pad_add_sysfs(device))
return -ENODEV;
status = acpi_install_notify_handler(device->handle,
Reported by FlawFinder.