zCore icon indicating copy to clipboard operation
zCore copied to clipboard

Whether to validate flags/options?

Open xxchan opened this issue 4 years ago • 3 comments

from_bits_truncate() is used in some syscalls in linux-syscall and zircon-syscall, so it is possible that the input flag has an invalid bit set. Should this return Err? I'm not sure of the behavior of linux and zircon when this situation happens.

xxchan avatar Aug 01 '20 10:08 xxchan

This should return Err(LxError::EINVAL) or Err(ZxError::INVALID_ARGS). And make sure that the bitflags contains all valid bits.

wangrunji0408 avatar Aug 03 '20 05:08 wangrunji0408

This should return Err(LxError::EINVAL) or Err(ZxError::INVALID_ARGS).

OK, I can fix this.

bitflags contains all valid bits

What do you mean by this? Isn't that already ensured?

xxchan avatar Aug 03 '20 05:08 xxchan

I'm not sure. Maybe need to check again...

wangrunji0408 avatar Aug 03 '20 15:08 wangrunji0408