The following issues were found
drivers/usb/gadget/function/u_ether_configfs.h
2 issues
Line: 108
Column: 10
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
mutex_lock(&opts->lock); \
qmult = gether_get_qmult(opts->net); \
mutex_unlock(&opts->lock); \
return sprintf(page, "%d\n", qmult); \
} \
\
static ssize_t _f_##_opts_qmult_store(struct config_item *item, \
const char *page, size_t len)\
{ \
Reported by FlawFinder.
Line: 174
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
int ret; \
\
mutex_lock(&opts->lock); \
ret = sprintf(page, "%02x\n", opts->_n_); \
mutex_unlock(&opts->lock); \
\
return ret; \
} \
\
Reported by FlawFinder.
drivers/scsi/mvsas/mv_64xx.c
2 issues
Line: 681
Column: 6
CWE codes:
120
20
u32 dwTmp;
dwTmp = ((u32)cmd << 24) | ((u32)length << 19);
if (read)
dwTmp |= 1U<<23;
if (addr != MV_MAX_U32) {
dwTmp |= 1U<<22;
dwTmp |= (addr & 0x0003FFFF);
Reported by FlawFinder.
drivers/staging/rtl8188eu/include/wlan_bssdef.h
2 issues
Line: 178
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 wlan_bssid_ex {
u32 Length;
unsigned char MacAddress[ETH_ALEN];
u8 Reserved[2];/* 0]: IS beacon frame */
struct ndis_802_11_ssid ssid;
u32 Privacy;
NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */
enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
Reported by FlawFinder.
Line: 186
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
enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
struct ndis_802_11_config Configuration;
enum ndis_802_11_network_infra InfrastructureMode;
unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
struct wlan_phy_info PhyInfo;
u32 ie_length;
u8 ies[MAX_IE_SZ]; /* timestamp, beacon interval, and
* capability information)
*/
Reported by FlawFinder.
drivers/scsi/megaraid.h
2 issues
Line: 492
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
mega_passthru pthru;
#if BITS_PER_LONG == 32
char __user *data; /* buffer <= 4096 for 0x80 commands */
char pad[4];
#endif
#if BITS_PER_LONG == 64
char __user *data;
#endif
} __attribute__ ((packed));
Reported by FlawFinder.
Line: 586
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
* MBOX_P macro converts a nitioctl_t pointer to megacmd_t pointer.
*/
typedef struct {
char signature[8]; /* Must contain "MEGANIT" */
u32 opcode; /* opcode for the command */
u32 adapno; /* adapter number */
union {
u8 __raw_mbox[18];
void __user *__uaddr; /* xferaddr for non-mbox cmds */
Reported by FlawFinder.
drivers/usb/atm/usbatm.h
2 issues
Line: 127
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
/* mini driver */
struct usbatm_driver *driver;
void *driver_data;
char driver_name[16];
unsigned int flags; /* set by mini-driver in bind() */
/* USB device */
struct usb_device *usb_dev;
struct usb_interface *usb_intf;
Reported by FlawFinder.
Line: 133
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
/* USB device */
struct usb_device *usb_dev;
struct usb_interface *usb_intf;
char description[64];
/* ATM device */
struct atm_dev *atm_dev;
/********************************
Reported by FlawFinder.
drivers/staging/rtl8192e/rtllib_crypt_tkip.c
2 issues
Line: 627
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
tkey->rx_tfm_michael = tfm3;
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
tkey->tx_iv16 = 1; /* TSC is initialized to 1 */
if (seq) {
tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) |
(seq[3] << 8) | seq[2];
Reported by FlawFinder.
Line: 653
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (!tkey->key_set)
return 0;
memcpy(key, tkey->key, TKIP_KEY_LEN);
if (seq) {
/* Return the sequence number of the last transmitted frame. */
u16 iv16 = tkey->tx_iv16;
u32 iv32 = tkey->tx_iv32;
Reported by FlawFinder.
drivers/staging/greybus/i2c.c
2 issues
Line: 137
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
msg = msgs;
for (i = 0; i < msg_count; i++) {
if (!(msg->flags & I2C_M_RD)) {
memcpy(data, msg->buf, msg->len);
data += msg->len;
}
msg++;
}
Reported by FlawFinder.
Line: 158
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
data = response->data;
for (i = 0; i < msg_count; i++) {
if (msg->flags & I2C_M_RD) {
memcpy(msg->buf, data, msg->len);
data += msg->len;
}
msg++;
}
}
Reported by FlawFinder.
drivers/tty/serdev/core.c
2 issues
Line: 152
Column: 27
CWE codes:
362
struct serdev_controller *ctrl = serdev->ctrl;
int ret;
if (!ctrl || !ctrl->ops->open)
return -EINVAL;
ret = ctrl->ops->open(ctrl);
if (ret)
return ret;
Reported by FlawFinder.
Line: 155
Column: 19
CWE codes:
362
if (!ctrl || !ctrl->ops->open)
return -EINVAL;
ret = ctrl->ops->open(ctrl);
if (ret)
return ret;
ret = pm_runtime_get_sync(&ctrl->dev);
if (ret < 0) {
Reported by FlawFinder.
drivers/staging/rtl8192e/rtllib.h
2 issues
Line: 2125
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
static inline const char *escape_essid(const char *essid, u8 essid_len)
{
static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
if (rtllib_is_empty_essid(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
Reported by FlawFinder.
Line: 2128
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
if (rtllib_is_empty_essid(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid);
return escaped;
Reported by FlawFinder.
drivers/video/fbdev/cobalt_lcdfb.c
2 issues
Line: 128
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
static ssize_t cobalt_lcdfb_read(struct fb_info *info, char __user *buf,
size_t count, loff_t *ppos)
{
char src[LCD_CHARS_MAX];
unsigned long pos;
int len, retval = 0;
pos = *ppos;
if (pos >= LCD_CHARS_MAX || count == 0)
Reported by FlawFinder.
Line: 174
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
static ssize_t cobalt_lcdfb_write(struct fb_info *info, const char __user *buf,
size_t count, loff_t *ppos)
{
char dst[LCD_CHARS_MAX];
unsigned long pos;
int len, retval = 0;
pos = *ppos;
if (pos >= LCD_CHARS_MAX || count == 0)
Reported by FlawFinder.