mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Avoid unsigned integer overflow
unsigned overflow is well defined, but creates noise when using sanitizers. unsigned overflow can be a symptom of logic issues of counter, so its reasonable to use. linux/LinuxProcessList.c:64:50: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:50 in linux/LinuxProcessList.c:64:11: runtime error: implicit conversion from type 'unsigned int' of value 4294967295 (32-bit, unsigned) to type 'int' changed the value to -1 (32-bit, signed) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:11 in linux/LinuxProcessList.c:64:78: runtime error: unsigned integer overflow: 4 - 136 cannot be represented in type 'unsigned int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:78 in
This commit is contained in:
parent
98ee833932
commit
00665e2a2b
@ -61,7 +61,7 @@ static ssize_t xread(int fd, void *buf, size_t count) {
|
||||
static int sortTtyDrivers(const void* va, const void* vb) {
|
||||
TtyDriver* a = (TtyDriver*) va;
|
||||
TtyDriver* b = (TtyDriver*) vb;
|
||||
return (a->major == b->major) ? (a->minorFrom - b->minorFrom) : (a->major - b->major);
|
||||
return (a->major == b->major) ? ((int)a->minorFrom - (int)b->minorFrom) : ((int)a->major - (int)b->major);
|
||||
}
|
||||
|
||||
static void LinuxProcessList_initTtyDrivers(LinuxProcessList* this) {
|
||||
|
Loading…
Reference in New Issue
Block a user