The following issues were found
drivers/usb/gadget/function/u_rndis.h
1 issues
Line: 28
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 config_group *rndis_interf_group;
struct usb_os_desc rndis_os_desc;
char rndis_ext_compat_id[16];
u8 class;
u8 subclass;
u8 protocol;
Reported by FlawFinder.
drivers/usb/gadget/function/u_uac1_legacy.h
1 issues
Line: 38
Column: 9
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
struct gaudio *card;
struct file *filp;
struct snd_pcm_substream *substream;
int access;
int format;
int channels;
int rate;
};
Reported by FlawFinder.
drivers/usb/gadget/function/uvc_v4l2.c
1 issues
Line: 44
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
req->length = min_t(unsigned int, uvc->event_length, data->length);
req->zero = data->length < uvc->event_length;
memcpy(req->buf, data->data, req->length);
return usb_ep_queue(cdev->gadget->ep0, req, GFP_KERNEL);
}
/* --------------------------------------------------------------------------
Reported by FlawFinder.
drivers/usb/gadget/function/uvc_video.c
1 issues
Line: 51
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
mem = buf->mem + queue->buf_used;
nbytes = min((unsigned int)len, buf->bytesused - queue->buf_used);
memcpy(data, mem, nbytes);
queue->buf_used += nbytes;
return nbytes;
}
Reported by FlawFinder.
drivers/usb/gadget/legacy/acm_ms.c
1 issues
Line: 94
#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data);
/*-------------------------------------------------------------------------*/
static struct usb_function *f_acm;
static struct usb_function_instance *f_acm_inst;
Reported by Cppcheck.
drivers/usb/gadget/legacy/dbgp.c
1 issues
Line: 385
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
req->length = min(length, len);
req->zero = len < req->length;
if (data && req->length)
memcpy(req->buf, data, req->length);
req->complete = dbgp_setup_complete;
return usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
fail:
Reported by FlawFinder.
drivers/usb/gadget/legacy/g_ffs.c
1 issues
Line: 75
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
.idProduct = cpu_to_le16(GFS_PRODUCT_ID),
};
static char *func_names[GFS_MAX_DEVS];
static unsigned int func_num;
module_param_named(bDeviceClass, gfs_dev_desc.bDeviceClass, byte, 0644);
MODULE_PARM_DESC(bDeviceClass, "USB Device class");
module_param_named(bDeviceSubClass, gfs_dev_desc.bDeviceSubClass, byte, 0644);
Reported by FlawFinder.
drivers/usb/gadget/legacy/mass_storage.c
1 issues
Line: 104
#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
FSG_MODULE_PARAMETERS(/* no prefix */, mod_data);
static int msg_do_config(struct usb_configuration *c)
{
int ret;
Reported by Cppcheck.
drivers/usb/gadget/legacy/multi.c
1 issues
Line: 121
#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data);
static struct usb_function_instance *fi_acm;
static struct usb_function_instance *fi_msg;
/********** RNDIS **********/
Reported by Cppcheck.
drivers/usb/gadget/legacy/nokia.c
1 issues
Line: 55
#endif /* CONFIG_USB_DEBUG */
FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data);
#define NOKIA_VENDOR_ID 0x0421 /* Nokia */
#define NOKIA_PRODUCT_ID 0x01c8 /* Nokia Gadget */
/* string IDs are assigned dynamically */
Reported by Cppcheck.