mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-26 20:07:28 +00:00
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>
26 lines
510 B
C
26 lines
510 B
C
#ifndef __COMPEL_KSIGSET_H__
|
|
#define __COMPEL_KSIGSET_H__
|
|
|
|
#include <compel/plugins/std/asm/syscall-types.h>
|
|
|
|
static inline void ksigfillset(k_rtsigset_t *set)
|
|
{
|
|
int i;
|
|
for (i = 0; i < _KNSIG_WORDS; i++)
|
|
set->sig[i] = (unsigned long)-1;
|
|
}
|
|
|
|
static inline void ksigemptyset(k_rtsigset_t *set)
|
|
{
|
|
int i;
|
|
for (i = 0; i < _KNSIG_WORDS; i++)
|
|
set->sig[i] = 0;
|
|
}
|
|
|
|
static inline void ksigaddset(k_rtsigset_t *set, int _sig)
|
|
{
|
|
int sig = _sig - 1;
|
|
set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW);
|
|
}
|
|
#endif
|