mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 20:42:56 +01: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:
committed by
Norman Feske
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();
|
||||
|
||||
Reference in New Issue
Block a user