The following issues were found
drivers/input/touchscreen/touchwin.c
2 issues
Line: 53
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 serio *serio;
int idx;
int touched;
unsigned char data[TW_LENGTH];
char phys[32];
};
static irqreturn_t tw_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
Reported by FlawFinder.
Line: 54
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 idx;
int touched;
unsigned char data[TW_LENGTH];
char phys[32];
};
static irqreturn_t tw_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
Reported by FlawFinder.
drivers/input/touchscreen/tsc200x-core.c
2 issues
Line: 81
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
__u16 bustype;
struct input_dev *idev;
char phys[32];
struct mutex mutex;
/* raw copy of previous x,y,z */
int in_x;
Reported by FlawFinder.
Line: 328
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
__tsc200x_enable(ts);
mutex_unlock(&ts->mutex);
return sprintf(buf, "%d\n", success);
}
static DEVICE_ATTR(selftest, S_IRUGO, tsc200x_selftest_show, NULL);
static struct attribute *tsc200x_attrs[] = {
Reported by FlawFinder.
drivers/input/touchscreen/tsc40.c
2 issues
Line: 20
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 input_dev *dev;
struct serio *serio;
u32 idx;
unsigned char data[PACKET_LENGTH];
char phys[32];
};
static void tsc_process_data(struct tsc_ser *ptsc)
{
Reported by FlawFinder.
Line: 21
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 serio *serio;
u32 idx;
unsigned char data[PACKET_LENGTH];
char phys[32];
};
static void tsc_process_data(struct tsc_ser *ptsc)
{
struct input_dev *dev = ptsc->dev;
Reported by FlawFinder.
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
2 issues
Line: 1321
CWE codes:
476
FIELD_PREP(STRTAB_STE_1_STRW, strw));
if (smmu->features & ARM_SMMU_FEAT_STALLS &&
!master->stall_enabled)
dst[1] |= cpu_to_le64(STRTAB_STE_1_S1STALLD);
val |= (s1_cfg->cdcfg.cdtab_dma & STRTAB_STE_0_S1CTXPTR_MASK) |
FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_S1_TRANS) |
FIELD_PREP(STRTAB_STE_0_S1CDMAX, s1_cfg->s1cdmax) |
Reported by Cppcheck.
Line: 1346
CWE codes:
476
val |= FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_S2_TRANS);
}
if (master->ats_enabled)
dst[1] |= cpu_to_le64(FIELD_PREP(STRTAB_STE_1_EATS,
STRTAB_STE_1_EATS_TRANS));
arm_smmu_sync_ste_for_sid(smmu, sid);
/* See comment in arm_smmu_write_ctx_desc() */
Reported by Cppcheck.
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
2 issues
Line: 409
Column: 49
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
#ifdef CONFIG_ACPI
static struct acpi_platform_list qcom_acpi_platlist[] = {
{ "LENOVO", "CB-01 ", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
{ "QCOM ", "QCOMEDK2", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
{ }
};
#endif
Reported by FlawFinder.
Line: 410
Column: 49
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
#ifdef CONFIG_ACPI
static struct acpi_platform_list qcom_acpi_platlist[] = {
{ "LENOVO", "CB-01 ", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
{ "QCOM ", "QCOMEDK2", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" },
{ }
};
#endif
struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
Reported by FlawFinder.
drivers/iommu/intel/pasid.c
2 issues
Line: 39
CWE codes:
908
raw_spin_lock_irqsave(&iommu->register_lock, flags);
dmar_writeq(iommu->reg + DMAR_VCMD_REG, VCMD_CMD_ALLOC);
IOMMU_WAIT_OP(iommu, DMAR_VCRSP_REG, dmar_readq,
!(res & VCMD_VRSP_IP), res);
raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
status_code = VCMD_VRSP_SC(res);
switch (status_code) {
case VCMD_VRSP_SC_SUCCESS:
Reported by Cppcheck.
Line: 70
CWE codes:
908
dmar_writeq(iommu->reg + DMAR_VCMD_REG,
VCMD_CMD_OPERAND(pasid) | VCMD_CMD_FREE);
IOMMU_WAIT_OP(iommu, DMAR_VCRSP_REG, dmar_readq,
!(res & VCMD_VRSP_IP), res);
raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
status_code = VCMD_VRSP_SC(res);
switch (status_code) {
case VCMD_VRSP_SC_SUCCESS:
Reported by Cppcheck.
drivers/iommu/virtio-iommu.c
2 issues
Line: 177
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
write_len = req->len - req->write_offset;
if (req->writeback && len == write_len)
memcpy(req->writeback, req->buf + req->write_offset,
write_len);
list_del(&req->list);
kfree(req);
}
Reported by FlawFinder.
Line: 242
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
req->writeback = buf + write_offset;
req->write_offset = write_offset;
}
memcpy(&req->buf, buf, write_offset);
sg_init_one(&top_sg, req->buf, write_offset);
sg_init_one(&bottom_sg, req->buf + write_offset, len - write_offset);
ret = virtqueue_add_sgs(vq, sg, 1, 1, req, GFP_ATOMIC);
Reported by FlawFinder.
drivers/ipack/devices/ipoctal.c
2 issues
Line: 358
Column: 2
CWE codes:
134
Suggestion:
Make format string constant
/* Fill struct tty_driver with ipoctal data */
tty->owner = THIS_MODULE;
tty->driver_name = KBUILD_MODNAME;
sprintf(name, KBUILD_MODNAME ".%d.%d.", bus_nr, slot);
tty->name = name;
tty->major = 0;
tty->minor_start = 0;
tty->type = TTY_DRIVER_TYPE_SERIAL;
Reported by FlawFinder.
Line: 267
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 res;
int i;
struct tty_driver *tty;
char name[20];
struct ipoctal_channel *channel;
struct ipack_region *region;
void __iomem *addr;
union scc2698_channel __iomem *chan_regs;
union scc2698_block __iomem *block_regs;
Reported by FlawFinder.
drivers/isdn/hardware/mISDN/hfc_multi.h
2 issues
Line: 199
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
u_long chip; /* chip configuration */
int masterclk; /* port that provides master clock -1=off */
unsigned char silence;/* silence byte */
unsigned char silence_data[128];/* silence block */
int dtmf; /* flag that dtmf is currently in process */
int Flen; /* F-buffer size */
int Zlen; /* Z-buffer size (must be int for calculation)*/
int max_trans; /* maximum transparent fifo fill */
int Zmin; /* Z-buffer offset */
Reported by FlawFinder.
Line: 241
Column: 9
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
* the bch->channel is equvalent to the hfc-channel
*/
struct hfc_chan chan[32];
signed char slot_owner[256]; /* owner channel of slot */
};
/* PLX GPIOs */
#define PLX_GPIO4_DIR_BIT 13
#define PLX_GPIO4_BIT 14
Reported by FlawFinder.
drivers/isdn/hardware/mISDN/ipac.h
2 issues
Line: 28
Column: 10
CWE codes:
362
void (*release)(struct isac_hw *);
int (*init)(struct isac_hw *);
int (*ctrl)(struct isac_hw *, u32, u_long);
int (*open)(struct isac_hw *, struct channel_req *);
u8 *mon_tx;
u8 *mon_rx;
int mon_txp;
int mon_txc;
int mon_rxp;
Reported by FlawFinder.
Line: 52
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
u8 fifo_size;
u8 off; /* offset to ICA or ICB */
u8 slot;
char log[64];
};
struct ipac_hw {
struct isac_hw isac;
struct hscx_hw hscx[2];
Reported by FlawFinder.