The following issues were found
drivers/platform/x86/intel_atomisp2_led.c
2 issues
Line: 80
Column: 30
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
static int __init atomisp2_led_init(void)
{
const struct dmi_system_id *system;
system = dmi_first_match(atomisp2_led_systems);
if (!system)
return -ENODEV;
Reported by FlawFinder.
Line: 83
Column: 7
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
const struct dmi_system_id *system;
system = dmi_first_match(atomisp2_led_systems);
if (!system)
return -ENODEV;
gpio_lookup = system->driver_data;
gpiod_add_lookup_table(gpio_lookup);
Reported by FlawFinder.
drivers/platform/x86/intel_menlow.c
2 issues
Line: 369
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
if (ACPI_FAILURE(status))
return -ENODEV;
return sprintf(buf, "%s\n", bios_enabled ? "enabled" : "disabled");
}
static int intel_menlow_add_one_attribute(char *name, umode_t mode, void *show,
void *store, struct device *dev,
acpi_handle handle)
Reported by FlawFinder.
Line: 309
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
if (result)
return result;
return sprintf(buf, "%lu", deci_kelvin_to_celsius(value));
}
static ssize_t aux0_show(struct device *dev,
struct device_attribute *dev_attr, char *buf)
{
Reported by FlawFinder.
drivers/platform/x86/intel_pmc_core.c
2 issues
Line: 641
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (!lpm_req_regs)
goto free_acpi_obj;
memcpy(lpm_req_regs, addr, lpm_size);
pmcdev->lpm_req_regs = lpm_req_regs;
free_acpi_obj:
ACPI_FREE(out_obj);
}
Reported by FlawFinder.
Line: 1362
Column: 11
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 seq_file *s = file->private_data;
struct pmc_dev *pmcdev = s->private;
bool clear = false, c10 = false;
unsigned char buf[8];
int idx, m, mode;
u32 reg;
if (count > sizeof(buf) - 1)
return -EINVAL;
Reported by FlawFinder.
drivers/platform/x86/intel_pmt_crashlog.c
2 issues
Line: 141
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
struct intel_pmt_entry *entry = dev_get_drvdata(dev);
int enabled = !pmt_crashlog_disabled(entry);
return sprintf(buf, "%d\n", enabled);
}
static ssize_t
enable_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
Reported by FlawFinder.
Line: 175
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
entry = dev_get_drvdata(dev);
trigger = pmt_crashlog_complete(entry);
return sprintf(buf, "%d\n", trigger);
}
static ssize_t
trigger_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
Reported by FlawFinder.
drivers/platform/x86/intel_scu_ipc.c
2 issues
Line: 495
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return -ENODEV;
}
memcpy(inbuf, in, inlen);
for (i = 0; i < inbuflen; i++)
ipc_data_writel(scu, inbuf[i], 4 * i);
cmdval = (size << 16) | (sub << 12) | cmd;
ipc_command(scu, cmdval);
Reported by FlawFinder.
Line: 509
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
for (i = 0; i < outbuflen; i++)
outbuf[i] = ipc_data_readl(scu, 4 * i);
memcpy(out, outbuf, outlen);
}
mutex_unlock(&ipclock);
if (err)
dev_err(&scu->dev, "IPC command %#x failed with %d\n", cmdval, err);
Reported by FlawFinder.
drivers/platform/x86/intel_telemetry_debugfs.c
2 issues
Line: 335
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
{
struct telemetry_evtlog evtlog[TELEM_MAX_OS_ALLOCATED_EVENTS];
struct telemetry_debugfs_conf *conf = debugfs_conf;
const char *name[TELEM_MAX_OS_ALLOCATED_EVENTS];
u32 pcs_idle_blkd[TELEM_PSS_IDLE_BLOCKED_EVTS],
pcs_s0ix_blkd[TELEM_PSS_S0IX_BLOCKED_EVTS],
pss_s0ix_wakeup[TELEM_PSS_S0IX_WAKEUP_EVTS],
pss_ltr_blkd[TELEM_PSS_LTR_BLOCKING_EVTS],
pss_idle[TELEM_PSS_IDLE_EVTS];
Reported by FlawFinder.
Line: 473
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 int telem_ioss_states_show(struct seq_file *s, void *unused)
{
struct telemetry_evtlog evtlog[TELEM_MAX_OS_ALLOCATED_EVENTS];
const char *name[TELEM_MAX_OS_ALLOCATED_EVENTS];
int index, ret, err;
ret = telemetry_read_eventlog(TELEM_IOSS, evtlog,
TELEM_MAX_OS_ALLOCATED_EVENTS);
if (ret < 0)
Reported by FlawFinder.
drivers/platform/x86/panasonic-laptop.c
2 issues
Line: 940
Column: 2
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
pcc->handle = device->handle;
pcc->num_sifr = num_sifr;
device->driver_data = pcc;
strcpy(acpi_device_name(device), ACPI_PCC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCC_CLASS);
result = acpi_pcc_init_input(pcc);
if (result) {
pr_err("Error installing keyinput handler\n");
Reported by FlawFinder.
Line: 941
Column: 2
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
pcc->num_sifr = num_sifr;
device->driver_data = pcc;
strcpy(acpi_device_name(device), ACPI_PCC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCC_CLASS);
result = acpi_pcc_init_input(pcc);
if (result) {
pr_err("Error installing keyinput handler\n");
goto out_sinf;
Reported by FlawFinder.
drivers/platform/x86/tc1100-wmi.c
2 issues
Line: 133
Column: 10
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
u32 result; \
acpi_status status = get_state(&result, instance); \
if (ACPI_SUCCESS(status)) \
return sprintf(buf, "%d\n", result); \
return sprintf(buf, "Read error\n"); \
} \
\
static ssize_t \
set_bool_##value(struct device *dev, struct device_attribute *attr, \
Reported by FlawFinder.
Line: 134
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
acpi_status status = get_state(&result, instance); \
if (ACPI_SUCCESS(status)) \
return sprintf(buf, "%d\n", result); \
return sprintf(buf, "Read error\n"); \
} \
\
static ssize_t \
set_bool_##value(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
Reported by FlawFinder.
drivers/platform/x86/topstar-laptop.c
2 issues
Line: 300
Column: 2
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
return -ENOMEM;
strcpy(acpi_device_name(device), "Topstar TPSACPI");
strcpy(acpi_device_class(device), TOPSTAR_LAPTOP_CLASS);
device->driver_data = topstar;
topstar->device = device;
err = topstar_acpi_init(topstar);
if (err)
Reported by FlawFinder.
Line: 299
Column: 2
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
if (!topstar)
return -ENOMEM;
strcpy(acpi_device_name(device), "Topstar TPSACPI");
strcpy(acpi_device_class(device), TOPSTAR_LAPTOP_CLASS);
device->driver_data = topstar;
topstar->device = device;
err = topstar_acpi_init(topstar);
Reported by FlawFinder.
drivers/pnp/card.c
2 issues
Line: 190
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
char *str = buf;
struct pnp_card *card = to_pnp_card(dmdev);
str += sprintf(str, "%s\n", card->name);
return (str - buf);
}
static DEVICE_ATTR_RO(name);
Reported by FlawFinder.
Line: 204
Column: 10
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
struct pnp_id *pos = card->id;
while (pos) {
str += sprintf(str, "%s\n", pos->id);
pos = pos->next;
}
return (str - buf);
}
Reported by FlawFinder.