mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
core: change policy incrementation to prefix op
Using prefix incrementation makes sure a policy with id == 0 is invalid. Fixes #1049.
This commit is contained in:
parent
e68eadf57b
commit
e79044d16a
@ -41,7 +41,11 @@ Policy_id Session_component::alloc_policy(size_t size)
|
||||
if (size > _argument_buffer.size)
|
||||
throw Policy_too_large();
|
||||
|
||||
Policy_id const id(_policy_cnt++);
|
||||
/*
|
||||
* Using prefix incrementation makes sure a policy with id == 0 is
|
||||
* invalid.
|
||||
*/
|
||||
Policy_id const id(++_policy_cnt);
|
||||
|
||||
if (!_md_alloc.withdraw(size))
|
||||
throw Out_of_metadata();
|
||||
|
Loading…
Reference in New Issue
Block a user