The following issues were found
drivers/bluetooth/hci_ath.c
2 issues
Line: 159
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
cmd.opcode = opcode;
cmd.index = cpu_to_le16(index);
cmd.len = dlen;
memcpy(cmd.data, data, dlen);
skb = __hci_cmd_sync(hdev, 0xfc0b, dlen + 4, &cmd, HCI_INIT_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);
kfree_skb(skb);
Reported by FlawFinder.
Line: 230
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
BT_DBG("hu %p skb %p", hu, skb);
/* Prepend skb with frame type */
memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
skb_queue_tail(&ath->txq, skb);
set_bit(HCI_UART_SENDING, &hu->tx_state);
schedule_work(&ath->ctxtsw);
Reported by FlawFinder.
drivers/char/nwbutton.c
2 issues
Line: 33
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
/* Times for the end of a sequence */
static DEFINE_TIMER(button_timer, button_sequence_finished);
static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
static char button_output_buffer[32]; /* Stores data to write out of device */
static int bcount; /* The number of bytes in the buffer */
static int bdelay = BUTTON_DELAY; /* The delay, in jiffies */
static struct button_callback button_callback_list[32]; /* The callback list */
static int callback_count; /* The number of callbacks registered */
static int reboot_count = NUM_PRESSES_REBOOT; /* Number of presses to reboot */
Reported by FlawFinder.
Line: 137
Column: 11
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
button_press_count == reboot_count)
kill_cad_pid(SIGINT, 1); /* Ask init to reboot us */
button_consume_callbacks (button_press_count);
bcount = sprintf (button_output_buffer, "%d\n", button_press_count);
button_press_count = 0; /* Reset the button press counter */
wake_up_interruptible (&button_wait_queue);
}
/*
Reported by FlawFinder.
drivers/clk/keystone/sci-clk.c
2 issues
Line: 469
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
tmp_clks = devm_kmalloc_array(dev, max_clks + 64,
sizeof(sci_clk),
GFP_KERNEL);
memcpy(tmp_clks, clks, max_clks * sizeof(sci_clk));
if (max_clks)
devm_kfree(dev, clks);
max_clks += 64;
clks = tmp_clks;
}
Reported by FlawFinder.
Line: 495
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (!provider->clocks)
return -ENOMEM;
memcpy(provider->clocks, clks, num_clks * sizeof(sci_clk));
provider->num_clocks = num_clks;
devm_kfree(dev, clks);
Reported by FlawFinder.
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
2 issues
Line: 694
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
/* VRAM usage */
uint64_t vram_usage;
struct attribute attr_vram;
char vram_filename[MAX_SYSFS_FILENAME_LEN];
/* SDMA activity tracking */
uint64_t sdma_past_activity_counter;
struct attribute attr_sdma;
char sdma_filename[MAX_SYSFS_FILENAME_LEN];
Reported by FlawFinder.
Line: 699
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
/* SDMA activity tracking */
uint64_t sdma_past_activity_counter;
struct attribute attr_sdma;
char sdma_filename[MAX_SYSFS_FILENAME_LEN];
/* Eviction activity tracking */
uint64_t last_evict_timestamp;
atomic64_t evict_duration_counter;
struct attribute attr_evict;
Reported by FlawFinder.
drivers/atm/adummy.c
2 issues
Line: 129
Column: 10
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
int left = *pos;
if (!left--)
return sprintf(page, "version %s\n", DRV_VERSION);
return 0;
}
static const struct atmdev_ops adummy_ops =
Reported by FlawFinder.
Line: 66
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
struct device_attribute *attr, char *buf)
{
struct atm_dev *atm_dev = container_of(dev, struct atm_dev, class_dev);
return sprintf(buf, "%d\n", atm_dev->signal);
}
static DEVICE_ATTR(signal, 0644, __show_signal, __set_signal);
static struct attribute *adummy_attrs[] = {
&dev_attr_signal.attr,
Reported by FlawFinder.
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
2 issues
Line: 756
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return -ENOMEM;
d = (new_start - old_start) * size;
memcpy(new, pold + d, new_n * size);
old = kvmalloc_array(old_n, size, GFP_KERNEL);
if (!old) {
kvfree(new);
return -ENOMEM;
Reported by FlawFinder.
Line: 765
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
d = (new_start == old_start) ? new_n * size : 0;
memcpy(old, pold + d, old_n * size);
kvfree(pold);
*(void **)ppold = old;
*(void **)ppnew = new;
Reported by FlawFinder.
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
2 issues
Line: 215
Column: 12
CWE codes:
134
Suggestion:
Use a constant for the format specification
#define sysfs_show_gen_prop(buffer, offs, fmt, ...) \
(offs += snprintf(buffer+offs, PAGE_SIZE-offs, \
fmt, __VA_ARGS__))
#define sysfs_show_32bit_prop(buffer, offs, name, value) \
sysfs_show_gen_prop(buffer, offs, "%s %u\n", name, value)
#define sysfs_show_64bit_prop(buffer, offs, name, value) \
sysfs_show_gen_prop(buffer, offs, "%s %llu\n", name, value)
Reported by FlawFinder.
Line: 1357
Column: 2
CWE codes:
120
amdgpu_amdkfd_get_cu_info(dev->gpu->kgd, &cu_info);
strncpy(dev->node_props.name, gpu->device_info->asic_name,
KFD_TOPOLOGY_PUBLIC_NAME_SIZE);
dev->node_props.simd_arrays_per_engine =
cu_info.num_shader_arrays_per_engine;
Reported by FlawFinder.
drivers/gpu/drm/amd/amdkfd/kfd_topology.h
2 issues
Line: 92
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
uint32_t num_sdma_xgmi_engines;
uint32_t num_sdma_queues_per_engine;
uint32_t num_cp_queues;
char name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
};
#define HSA_MEM_HEAP_TYPE_SYSTEM 0
#define HSA_MEM_HEAP_TYPE_FB_PUBLIC 1
#define HSA_MEM_HEAP_TYPE_FB_PRIVATE 2
Reported by FlawFinder.
Line: 161
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 kfd_perf_properties {
struct list_head list;
char block_name[16];
uint32_t max_concurrent;
struct attribute_group *attr_group;
};
struct kfd_topology_device {
Reported by FlawFinder.
crypto/poly1305_generic.c
2 issues
Line: 80
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (unlikely(dctx->buflen)) {
bytes = min(srclen, POLY1305_BLOCK_SIZE - dctx->buflen);
memcpy(dctx->buf + dctx->buflen, src, bytes);
src += bytes;
srclen -= bytes;
dctx->buflen += bytes;
if (dctx->buflen == POLY1305_BLOCK_SIZE) {
Reported by FlawFinder.
Line: 100
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (unlikely(srclen)) {
dctx->buflen = srclen;
memcpy(dctx->buf, src, srclen);
}
return 0;
}
Reported by FlawFinder.
drivers/crypto/qat/qat_common/adf_transport_debug.c
2 issues
Line: 93
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 adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name)
{
struct adf_etr_ring_debug_entry *ring_debug;
char entry_name[8];
ring_debug = kzalloc(sizeof(*ring_debug), GFP_KERNEL);
if (!ring_debug)
return -ENOMEM;
Reported by FlawFinder.
Line: 195
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 adf_accel_dev *accel_dev = bank->accel_dev;
struct dentry *parent = accel_dev->transport->debug;
char name[8];
snprintf(name, sizeof(name), "bank_%02d", bank->bank_number);
bank->bank_debug_dir = debugfs_create_dir(name, parent);
bank->bank_debug_cfg = debugfs_create_file("config", S_IRUSR,
bank->bank_debug_dir, bank,
Reported by FlawFinder.