The following issues were found
tools/testing/kunit/qemu_config.py
1 issues
Line: 1
Column: 1
# SPDX-License-Identifier: GPL-2.0
#
# Collection of configs for building non-UML kernels and running them on QEMU.
#
# Copyright (C) 2021, Google LLC.
# Author: Brendan Higgins <brendanhiggins@google.com>
from collections import namedtuple
Reported by Pylint.
tools/testing/radix-tree/linux/kernel.h
1 issues
Line: 16
Column: 16
CWE codes:
134
Suggestion:
Use a constant for the format specification
#include <linux/log2.h>
#include "../../../include/linux/kconfig.h"
#define printk printf
#define pr_info printk
#define pr_debug printk
#define pr_cont printk
#define __acquires(x)
Reported by FlawFinder.
tools/testing/radix-tree/linux/radix-tree.h
1 issues
Line: 21
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
#define printv(verbosity_level, fmt, ...) \
if(test_verbose >= verbosity_level) \
printf(fmt, ##__VA_ARGS__)
#undef call_rcu
#define call_rcu(x, y) trace_call_rcu(x, y)
#endif /* _TEST_RADIX_TREE_H */
Reported by FlawFinder.
tools/testing/selftests/arm64/mte/check_child_memory.c
1 issues
Line: 93
Column: 10
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
item = sizeof(sizes)/sizeof(int);
mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG);
for (run = 0; run < item; run++) {
ptr = (char *)mte_allocate_memory_tag_range(sizes[run], mem_type, mapping,
UNDERFLOW, OVERFLOW);
if (check_allocated_memory_range(ptr, sizes[run], mem_type,
UNDERFLOW, OVERFLOW) != KSFT_PASS)
return KSFT_FAIL;
result = check_child_tag_inheritance(ptr, sizes[run], mode);
Reported by FlawFinder.
tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
1 issues
Line: 48
Column: 2
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
uint64_t prctl_get;
uint64_t prctl_tcf;
srand(time(NULL) ^ (pid << 16) ^ (tid << 16));
prctl_tag_mask = rand() & 0xffff;
if (prctl_tag_mask % 2)
prctl_tcf = PR_MTE_TCF_SYNC;
Reported by FlawFinder.
tools/testing/selftests/bpf/bench.c
1 issues
Line: 29
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
{
if (level == LIBBPF_DEBUG && !env.verbose)
return 0;
return vfprintf(stderr, format, args);
}
static int bump_memlock_rlimit(void)
{
struct rlimit rlim_new = {
Reported by FlawFinder.
tools/testing/selftests/bpf/benchs/bench_rename.c
1 issues
Line: 56
Column: 11
CWE codes:
362
exit(1);
}
ctx.fd = open("/proc/self/comm", O_WRONLY|O_TRUNC);
if (ctx.fd < 0) {
fprintf(stderr, "failed to open /proc/self/comm: %d\n", -errno);
exit(1);
}
}
Reported by FlawFinder.
tools/testing/selftests/bpf/bpf_rand.h
1 issues
Line: 32
Column: 2
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
static inline void bpf_semi_rand_init(void)
{
srand(time(NULL));
}
static inline uint64_t bpf_semi_rand_get(void)
{
switch (rand() % 39) {
Reported by FlawFinder.
tools/testing/selftests/bpf/bpf_tcp_helpers.h
1 issues
Line: 150
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
#define TCP_CONG_NEEDS_ECN 0x2
struct tcp_congestion_ops {
char name[TCP_CA_NAME_MAX];
__u32 flags;
/* initialize private data (optional) */
void (*init)(struct sock *sk);
/* cleanup private data (optional) */
Reported by FlawFinder.
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod-events.h
1 issues
Line: 23
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
),
TP_fast_assign(
__entry->pid = task->pid;
memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
__entry->off = ctx->off;
__entry->len = ctx->len;
),
TP_printk("pid=%d comm=%s off=%llu len=%zu",
__entry->pid, __entry->comm, __entry->off, __entry->len)
Reported by FlawFinder.