mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Fix coverity defects: CID 147540, 147542
CID 147540: unsigned_compare - Cast nsec to a int32_t to properly detect the expected overflow. CID 147542: unsigned_compare - intval can never be less than ZIO_FAILURE_MODE_WAIT which is defined to be zero. Remove this useless check. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn> Closes #5379
This commit is contained in:
parent
7e5ea7be7f
commit
3bfd95d589
@ -146,7 +146,7 @@ zpios_timespec_normalize(zpios_timespec_t *ts, uint32_t sec, uint32_t nsec)
|
||||
nsec -= NSEC_PER_SEC;
|
||||
sec++;
|
||||
}
|
||||
while (nsec < 0) {
|
||||
while (((int32_t)nsec) < 0) {
|
||||
nsec += NSEC_PER_SEC;
|
||||
sec--;
|
||||
}
|
||||
|
@ -555,8 +555,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
|
||||
|
||||
case ZPOOL_PROP_FAILUREMODE:
|
||||
error = nvpair_value_uint64(elem, &intval);
|
||||
if (!error && (intval < ZIO_FAILURE_MODE_WAIT ||
|
||||
intval > ZIO_FAILURE_MODE_PANIC))
|
||||
if (!error && intval > ZIO_FAILURE_MODE_PANIC)
|
||||
error = SET_ERROR(EINVAL);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user