The following issues were found

tools/testing/selftests/proc/proc-uptime-001.c
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 31 Column: 7 CWE codes: 362

              	uint64_t start, u0, u1, i0, i1;
	int fd;

	fd = open("/proc/uptime", O_RDONLY);
	assert(fd >= 0);

	proc_uptime(fd, &u0, &i0);
	start = u0;
	do {

            

Reported by FlawFinder.

tools/testing/selftests/proc/proc-uptime-002.c
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 59 Column: 7 CWE codes: 362

              		m = malloc(len);
	} while (sys_sched_getaffinity(0, len, m) == -EINVAL);

	fd = open("/proc/uptime", O_RDONLY);
	assert(fd >= 0);

	proc_uptime(fd, &u0, &i0);
	for (cpu = 0; cpu < len * 8; cpu++) {
		memset(m, 0, len);

            

Reported by FlawFinder.

tools/testing/selftests/proc/proc-uptime.h
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

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

              static void proc_uptime(int fd, uint64_t *uptime, uint64_t *idle)
{
	uint64_t val1, val2;
	char buf[64], *p;
	ssize_t rv;

	/* save "p < end" checks */
	memset(buf, 0, sizeof(buf));
	rv = pread(fd, buf, sizeof(buf), 0);

            

Reported by FlawFinder.

tools/testing/selftests/ptrace/peeksiginfo.c
1 issues
fprintf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 40 Column: 3 CWE codes: 134
Suggestion: Use a constant for the format specification

              #endif

#define err(fmt, ...)						\
		fprintf(stderr,					\
			"Error (%s:%d): " fmt,			\
			__FILE__, __LINE__, ##__VA_ARGS__)

static int check_error_paths(pid_t child)
{

            

Reported by FlawFinder.

tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/percpu.h
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 86 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

               * type*. This will cause a compile time error if type is too big.
 */
#define DEFINE_PER_CPU(type, name) \
	char name[NR_CPUS][PERCPU_OFFSET]; \
	typedef char percpu_too_big_##name \
		[sizeof(type) > PERCPU_OFFSET ? -1 : 1]

#define for_each_possible_cpu(cpu) \
	for ((cpu) = 0; (cpu) < NR_CPUS; ++(cpu))

            

Reported by FlawFinder.

sound/usb/usx2y/usbusx2y.h
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 32 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			stride;
	struct urb		*in04_urb;
	void			*in04_buf;
	char			in04_last[24];
	unsigned int		in04_int_calls;
	struct snd_usx2y_urb_seq	*us04;
	wait_queue_head_t	in04_wait_queue;
	struct snd_usx2y_async_seq	as04;
	unsigned int		rate,

            

Reported by FlawFinder.

tools/testing/selftests/rseq/rseq.h
1 issues
fprintf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 61 Column: 2 CWE codes: 134
Suggestion: Use a constant for the format specification

              #define __rseq_str(x)		__rseq_str_1(x)

#define rseq_log(fmt, args...)						       \
	fprintf(stderr, fmt "(in %s() at " __FILE__ ":" __rseq_str(__LINE__)"\n", \
		## args, __func__)

#define rseq_bug(fmt, args...)		\
	do {				\
		rseq_log(fmt, ##args);	\

            

Reported by FlawFinder.

tools/testing/selftests/rtc/setdate.c
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 41 Column: 7 CWE codes: 362

              		return 1;
	}

	fd = open(rtc, O_RDONLY);
	if (fd == -1) {
		perror(rtc);
		exit(errno);
	}


            

Reported by FlawFinder.

tools/perf/arch/mips/util/dwarf-regs.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 22 Column: 14 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

              #include <stdio.h>
#include <dwarf-regs.h>

static const char *mips_gpr_names[32] = {
	"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9",
	"$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19",
	"$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29",
	"$30", "$31"
};

            

Reported by FlawFinder.

tools/perf/arch/nds32/util/header.c
1 issues
sprintf - Does not check for buffer overflows
Security

Line: 26 Column: 2 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              		return NULL;

	cpus = cpu_map__get(pmu->cpus);
	sprintf(buf, "0x%x", cpus->nr - 1);
	cpu_map__put(cpus);
	return buf;
}

            

Reported by FlawFinder.