The following issues were found
tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c
1 issues
Line: 76
CWE codes:
570
unsigned long *ip = &UCONTEXT_NIA(uc);
struct extbl_entry *entry = (struct extbl_entry *)__start___ex_table;
while (entry < (struct extbl_entry *)__stop___ex_table) {
unsigned long insn, fixup;
insn = (unsigned long)&entry->insn + entry->insn;
fixup = (unsigned long)&entry->fixup + entry->fixup;
Reported by Cppcheck.
tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
1 issues
Line: 49
Column: 17
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 volatile struct gstruct gstruct __attribute__((aligned(512)));
static volatile char cwd[PATH_MAX] __attribute__((aligned(8)));
static void get_dbginfo(pid_t child_pid, struct ppc_debug_info *dbginfo)
{
if (ptrace(PPC_PTRACE_GETHWDBGINFO, child_pid, NULL, dbginfo)) {
perror("Can't get breakpoint info");
Reported by FlawFinder.
sound/x86/intel_hdmi_audio.h
1 issues
Line: 106
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 snd_intelhad_card *card_ctx;
bool connected;
struct pcm_stream_info stream_info;
unsigned char eld[HDMI_MAX_ELD_BYTES];
bool dp_output;
unsigned int aes_bits;
spinlock_t had_spinlock;
struct device *dev;
struct snd_pcm_chmap *chmap;
Reported by FlawFinder.
sound/virtio/virtio_pcm.c
1 issues
Line: 428
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
vpcm->pcm->info_flags = 0;
vpcm->pcm->dev_class = SNDRV_PCM_CLASS_GENERIC;
vpcm->pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
snprintf(vpcm->pcm->name, sizeof(vpcm->pcm->name),
VIRTIO_SND_PCM_NAME " %u", vpcm->pcm->device);
vpcm->pcm->private_data = vpcm;
vpcm->pcm->nonatomic = true;
for (i = 0; i < ARRAY_SIZE(vpcm->streams); ++i) {
Reported by FlawFinder.
tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
1 issues
Line: 22
Column: 2
CWE codes:
134
Suggestion:
Use a constant for the format specification
static int test_##_name(void) \
{ \
int rc; \
printf("Testing " #_name); \
errno = 0; \
rc = syscall(_num, -1, 0, 0, 0, 0, 0); \
printf("\treturned %d, errno %d\n", rc, errno); \
return errno == ENOSYS; \
}
Reported by FlawFinder.
tools/testing/selftests/powerpc/tm/tm-exec.c
1 issues
Line: 38
Column: 2
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
"1: ;"
: : : "memory");
execl(path, "tm-exec", "--child", NULL);
/* Shouldn't get here */
perror("execl() failed");
return 1;
}
Reported by FlawFinder.
tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
1 issues
Line: 75
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
exit(-1);
}
memcpy(&ucp->uc_link->uc_mcontext, &ucp->uc_mcontext,
sizeof(ucp->uc_mcontext));
/* Forcing to enable MSR[TM] */
UCONTEXT_MSR(ucp) |= MSR_TS_S;
Reported by FlawFinder.
tools/testing/selftests/powerpc/tm/tm-syscall.c
1 issues
Line: 80
now.tv_usec = 0;
timeradd(&end, &now, &end);
for (count = 0; timercmp(&now, &end, <); count++) {
/*
* Test a syscall within a suspended transaction and verify
* that it succeeds.
*/
FAIL_IF(getppid_tm(true) == -1); /* Should succeed. */
Reported by Cppcheck.
tools/testing/selftests/powerpc/tm/tm-tar.c
1 issues
Line: 84
Column: 16
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)
argv[0]);
return 1;
} else {
num_loops = atoi(argv[1]);
}
}
printf("Starting, %d loops\n", num_loops);
Reported by FlawFinder.
tools/testing/selftests/powerpc/tm/tm-tmspr.c
1 issues
Line: 139
Column: 16
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)
printf("Syntax:\t [<num loops>]\n");
return 0;
} else {
num_loops = atoi(argv[1]);
}
}
return test_harness(test_tmspr, "tm_tmspr");
}
Reported by FlawFinder.