mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
compel/ksigset: fix ksigaddset() UB and flushing mask
Found by Coverity error: > CID 172193 (#1 of 1): Bad bit shift operation (BAD_SHIFT) > 1. large_shift: In expression 1 << sig % 64, left shifting > by more than 31 bits has undefined behavior. The shift amount, > sig % 64, is as much as 63. That is: 1. yes, UB 2. while adding a signal to mask, this has flushed all other signals from mask. Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
cda7d6b2f9
commit
72557edb15
1 changed files with 1 additions and 1 deletions
|
|
@ -20,6 +20,6 @@ static inline void ksigemptyset(k_rtsigset_t *set)
|
|||
static inline void ksigaddset(k_rtsigset_t *set, int _sig)
|
||||
{
|
||||
int sig = _sig - 1;
|
||||
set->sig[sig / _NSIG_BPW] = 1 << (sig % _NSIG_BPW);
|
||||
set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue