DEBUG: fd: detect possibly invalid tgid in fd_insert()
Since the API is still a bit young, let's make sure nobody tries to assign and FD to a group not strictly 1..MAX_TGROUPS as that would indicate a bug. Note: some of these might be relaxed to BUG_ON_HOT() in the future
This commit is contained in:
parent
6983426354
commit
51b1fcedeb
|
@ -436,6 +436,7 @@ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), int tgid
|
|||
BUG_ON(fd < 0 || fd >= global.maxsock);
|
||||
BUG_ON(fdtab[fd].owner != NULL);
|
||||
BUG_ON(fdtab[fd].state != 0);
|
||||
BUG_ON(tgid < 1 || tgid > MAX_TGROUPS);
|
||||
|
||||
thread_mask &= tg->threads_enabled;
|
||||
BUG_ON(thread_mask == 0);
|
||||
|
|
Loading…
Reference in New Issue