[haiku-commits] Re: haiku: hrev53988 - src/system/kernel/vm

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 16 Mar 2020 12:46:12 -0400

On Mon, 16 Mar 2020 at 12:40, waddlesplash <waddlesplash@xxxxxxxxx> wrote:


On Mon, Mar 16, 2020, 11:58 AM Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:

+static inline bool
+validate_user_range(const void* addr, size_t size)
+{
[...]
+     // Validate that the address does not cross the kernel/user boundary.
+     if (IS_USER_ADDRESS(address))
+             return IS_USER_ADDRESS(address + size);
+     else
+             return !IS_USER_ADDRESS(address + size);

Superfluous and misleading else.


How so?


In both cases, we return. Therefore, the else is unnecessary, since it
is effectively the end of the function.

Regards,

Rene

Other related posts: