The following issues were found
drivers/nvmem/meson-mx-efuse.c
1 issues
Line: 158
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (err)
break;
memcpy(buf + i, &tmp,
min_t(size_t, bytes - i, efuse->config.word_size));
}
meson_mx_efuse_mask_bits(efuse, MESON_MX_EFUSE_CNTL1,
MESON_MX_EFUSE_CNTL1_AUTO_RD_ENABLE, 0);
Reported by FlawFinder.
drivers/nvmem/imx-ocotp.c
1 issues
Line: 213
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
index = offset % 4;
memcpy(val, &p[index], bytes);
read_end:
clk_disable_unprepare(priv->clk);
mutex_unlock(&ocotp_mutex);
Reported by FlawFinder.
drivers/nvmem/imx-ocotp-scu.c
1 issues
Line: 171
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
buf++;
}
memcpy(val, (u8 *)p, bytes);
mutex_unlock(&scu_ocotp_mutex);
kfree(p);
Reported by FlawFinder.
drivers/nvme/host/trace.h
1 issues
Line: 41
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static inline void __assign_disk_name(char *name, struct gendisk *disk)
{
if (disk)
memcpy(name, disk->disk_name, DISK_NAME_LEN);
else
memset(name, 0, DISK_NAME_LEN);
}
#endif
Reported by FlawFinder.
drivers/nvme/host/tcp.c
1 issues
Line: 1463
Column: 19
CWE codes:
126
sockptr_t optval = KERNEL_SOCKPTR(iface);
ret = sock_setsockopt(queue->sock, SOL_SOCKET, SO_BINDTODEVICE,
optval, strlen(iface));
if (ret) {
dev_err(nctrl->device,
"failed to bind to interface %s queue %d err %d\n",
iface, qid, ret);
goto err_sock;
Reported by FlawFinder.
drivers/nvme/host/rdma.c
1 issues
Line: 1647
CWE codes:
562
wr.send_flags = IB_SEND_SIGNALED;
if (first)
first->next = ≀
else
first = ≀
ret = ib_post_send(queue->qp, first, NULL);
if (unlikely(ret)) {
Reported by Cppcheck.
drivers/nvme/host/pci.c
1 issues
Line: 506
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
bool write_sq)
{
spin_lock(&nvmeq->sq_lock);
memcpy(nvmeq->sq_cmds + (nvmeq->sq_tail << nvmeq->sqes),
cmd, sizeof(*cmd));
if (++nvmeq->sq_tail == nvmeq->q_depth)
nvmeq->sq_tail = 0;
nvme_write_sq_db(nvmeq, write_sq);
spin_unlock(&nvmeq->sq_lock);
Reported by FlawFinder.
drivers/nvme/host/fabrics.h
1 issues
Line: 39
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 nvmf_host {
struct kref ref;
struct list_head list;
char nqn[NVMF_NQN_SIZE];
uuid_t id;
};
/**
* enum nvmf_parsing_opts - used to define the sysfs parsing options used.
Reported by FlawFinder.
drivers/nvdimm/nd.h
1 issues
Line: 271
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 nd_btt *to_nd_btt(struct device *dev);
struct nd_gen_sb {
char reserved[SZ_4K - 8];
__le64 checksum;
};
u64 nd_sb_checksum(struct nd_gen_sb *sb);
#if IS_ENABLED(CONFIG_BTT)
Reported by FlawFinder.
drivers/nvdimm/label.h
1 issues
Line: 115
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
* @id: "{blk|pmem}-<namespace uuid>"
*/
struct nd_label_id {
char id[ND_LABEL_ID_SIZE];
};
/*
* If the 'best' index is invalid, so is the 'next' index. Otherwise,
* the next index is MOD(index+1, 2)
Reported by FlawFinder.