The following issues were found
include/linux/pps_kernel.h
2 issues
Line: 24
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
/* The specific PPS source info */
struct pps_source_info {
char name[PPS_MAX_NAME_LEN]; /* symbolic name */
char path[PPS_MAX_NAME_LEN]; /* path of connected device */
int mode; /* PPS allowed mode */
void (*echo)(struct pps_device *pps,
int event, void *data); /* PPS echo function */
Reported by FlawFinder.
Line: 25
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
/* The specific PPS source info */
struct pps_source_info {
char name[PPS_MAX_NAME_LEN]; /* symbolic name */
char path[PPS_MAX_NAME_LEN]; /* path of connected device */
int mode; /* PPS allowed mode */
void (*echo)(struct pps_device *pps,
int event, void *data); /* PPS echo function */
Reported by FlawFinder.
include/linux/pstore.h
2 issues
Line: 191
Column: 9
CWE codes:
362
int max_reason;
void *data;
int (*open)(struct pstore_info *psi);
int (*close)(struct pstore_info *psi);
ssize_t (*read)(struct pstore_record *record);
int (*write)(struct pstore_record *record);
int (*write_user)(struct pstore_record *record,
const char __user *buf);
Reported by FlawFinder.
Line: 193
Column: 13
CWE codes:
120
20
int (*open)(struct pstore_info *psi);
int (*close)(struct pstore_info *psi);
ssize_t (*read)(struct pstore_record *record);
int (*write)(struct pstore_record *record);
int (*write_user)(struct pstore_record *record,
const char __user *buf);
int (*erase)(struct pstore_record *record);
};
Reported by FlawFinder.
include/linux/sched_clock.h
2 issues
Line: 39
Column: 40
CWE codes:
120
20
extern void generic_sched_clock_init(void);
extern void sched_clock_register(u64 (*read)(void), int bits,
unsigned long rate);
#else
static inline void generic_sched_clock_init(void) { }
static inline void sched_clock_register(u64 (*read)(void), int bits,
Reported by FlawFinder.
Line: 44
Column: 47
CWE codes:
120
20
#else
static inline void generic_sched_clock_init(void) { }
static inline void sched_clock_register(u64 (*read)(void), int bits,
unsigned long rate)
{
}
#endif
Reported by FlawFinder.
include/linux/selection.h
2 issues
Line: 43
Column: 58
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
extern void complement_pos(struct vc_data *vc, int offset);
extern void invert_screen(struct vc_data *vc, int offset, int count, bool viewed);
extern void getconsxy(const struct vc_data *vc, unsigned char xy[static 2]);
extern void putconsxy(struct vc_data *vc, unsigned char xy[static const 2]);
extern u16 vcs_scr_readw(const struct vc_data *vc, const u16 *org);
extern void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org);
extern void vcs_scr_updated(struct vc_data *vc);
Reported by FlawFinder.
Line: 44
Column: 52
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
extern void invert_screen(struct vc_data *vc, int offset, int count, bool viewed);
extern void getconsxy(const struct vc_data *vc, unsigned char xy[static 2]);
extern void putconsxy(struct vc_data *vc, unsigned char xy[static const 2]);
extern u16 vcs_scr_readw(const struct vc_data *vc, const u16 *org);
extern void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org);
extern void vcs_scr_updated(struct vc_data *vc);
Reported by FlawFinder.
include/linux/signal.h
2 issues
Line: 17
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static inline void copy_siginfo(kernel_siginfo_t *to,
const kernel_siginfo_t *from)
{
memcpy(to, from, sizeof(*to));
}
static inline void clear_siginfo(kernel_siginfo_t *info)
{
memset(info, 0, sizeof(*info));
Reported by FlawFinder.
Line: 30
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static inline void copy_siginfo_to_external(siginfo_t *to,
const kernel_siginfo_t *from)
{
memcpy(to, from, sizeof(*from));
memset(((char *)to) + sizeof(struct kernel_siginfo), 0,
SI_EXPANSION_SIZE);
}
int copy_siginfo_to_user(siginfo_t __user *to, const kernel_siginfo_t *from);
Reported by FlawFinder.
include/linux/spi/spi.h
2 issues
Line: 186
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 irq;
void *controller_state;
void *controller_data;
char modalias[SPI_NAME_SIZE];
const char *driver_override;
int cs_gpio; /* LEGACY: chip select gpio */
struct gpio_desc *cs_gpiod; /* chip select gpio desc */
struct spi_delay word_delay; /* inter-word delay */
Reported by FlawFinder.
Line: 1435
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
* controller_data goes to spi_device.controller_data,
* irq is copied too
*/
char modalias[SPI_NAME_SIZE];
const void *platform_data;
const struct software_node *swnode;
void *controller_data;
int irq;
Reported by FlawFinder.
tools/testing/selftests/vm/mremap_dontunmap.c
2 issues
Line: 30
Column: 2
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
char cmd[32];
snprintf(cmd, sizeof(cmd), "cat /proc/%d/maps", getpid());
system(cmd);
}
#define BUG_ON(condition, description) \
do { \
if (condition) { \
Reported by FlawFinder.
Line: 27
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 void dump_maps(void)
{
char cmd[32];
snprintf(cmd, sizeof(cmd), "cat /proc/%d/maps", getpid());
system(cmd);
}
Reported by FlawFinder.
tools/usb/usbip/src/utils.c
2 issues
Line: 18
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 modify_match_busid(char *busid, int add)
{
char attr_name[] = "match_busid";
char command[SYSFS_BUS_ID_SIZE + 4];
char match_busid_attr_path[SYSFS_PATH_MAX];
int rc;
int cmd_size;
snprintf(match_busid_attr_path, sizeof(match_busid_attr_path),
Reported by FlawFinder.
Line: 19
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
{
char attr_name[] = "match_busid";
char command[SYSFS_BUS_ID_SIZE + 4];
char match_busid_attr_path[SYSFS_PATH_MAX];
int rc;
int cmd_size;
snprintf(match_busid_attr_path, sizeof(match_busid_attr_path),
"%s/%s/%s/%s/%s/%s", SYSFS_MNT_PATH, SYSFS_BUS_NAME,
Reported by FlawFinder.
tools/testing/selftests/timers/skew_consistency.c
2 issues
Line: 52
Column: 10
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
pid = fork();
if (!pid)
return system("./inconsistency-check -c 1 -t 600");
ppm = 500;
ret = 0;
while (pid != waitpid(pid, &ret, WNOHANG)) {
Reported by FlawFinder.
Line: 62
Column: 3
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
tx.modes = ADJ_FREQUENCY;
tx.freq = ppm << 16;
adjtimex(&tx);
usleep(500000);
}
/* Set things back */
tx.modes = ADJ_FREQUENCY;
tx.offset = 0;
Reported by FlawFinder.
tools/testing/selftests/vm/map_hugetlb.c
2 issues
Line: 78
Column: 12
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
int shift = 0;
if (argc > 1)
length = atol(argv[1]) << 20;
if (argc > 2) {
shift = atoi(argv[2]);
if (shift)
flags |= (shift & MAP_HUGE_MASK) << MAP_HUGE_SHIFT;
}
Reported by FlawFinder.
Line: 80
Column: 11
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
if (argc > 1)
length = atol(argv[1]) << 20;
if (argc > 2) {
shift = atoi(argv[2]);
if (shift)
flags |= (shift & MAP_HUGE_MASK) << MAP_HUGE_SHIFT;
}
if (shift)
Reported by FlawFinder.