Actions
Bug #7747
closedaffinity: warnings in the granular thread affinity settings code
Affected Versions:
Effort:
Difficulty:
Label:
Description
Reports:
290 tv->printable_name = printable_threadname;
CID 1648525: (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking live_dev suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
291 if (live_dev) {
292 tv->iface_name = SCStrdup(live_dev);
293 if (tv->iface_name == NULL) {
294 FatalError("Failed to allocate memory for iface name");
295 }
296 } else {
297 tv->iface_name = NULL;
298 }
2nd:
946static uint16\_t CPUSelectDefault(ThreadsAffinityType \*taf)
947{
948 uint16\_t cpu = taf\->lcpu\[0\];
949 int attempts = 0;
1. Condition \_\_cpu / 8 < 128UL /\* sizeof (cpu\_set\_t) \*/, taking true branch.
2. Condition ((\_\_cpu\_mask const \*)taf->cpu\_set.\_\_bits\[\_\_cpu / (64UL /\* 8 \* sizeof (\_\_cpu\_mask) \*/)\] & (1UL /\* (\_\_cpu\_mask)1 \*/ << \_\_cpu % (64UL /\* 8 \* sizeof (\_\_cpu\_mask) \*/))) != 0, taking false branch.
3. Condition !({...; (\_\_cpu / 8 < 128UL /\* sizeof (cpu\_set\_t) \*/) ? ((\_\_cpu\_mask const \*)taf->cpu\_set.\_\_bits\[\_\_cpu / (64UL /\* 8 \* sizeof (\_\_cpu\_mask) \*/)\] & (1UL /\* (\_\_cpu\_mask)1 \*/ << \_\_cpu % (64UL /\* 8 \* sizeof (\_\_cpu\_mask) \*/))) != 0 : 0;}), taking true branch.
4. Condition attempts < 2, taking true branch.
950 while (!CPU\_ISSET(cpu, &taf\->cpu\_set) && attempts < 2) {
5. zero\_return: Function call UtilCpuGetNumProcessorsOnline() returns 0.\[show details\]
CID 1648526: (#1 of 1): Division or modulo by zero (DIVIDE\_BY\_ZERO)
6. divide\_by\_zero: In expression (cpu + 1) % UtilCpuGetNumProcessorsOnline(), modulo by expression UtilCpuGetNumProcessorsOnline() which may be zero has undefined behavior.
951 cpu = (cpu + 1) % UtilCpuGetNumProcessorsOnline();
952 if (cpu == 0) {
953 attempts++;
954 }
955 }
956
957 taf\->lcpu\[0\] = cpu + 1;
958 return cpu;
959}
Actions