mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 22:58:26 +00:00
committed by
Christian Helmuth
parent
5aec67d5bb
commit
78e18981fb
@ -166,12 +166,10 @@ class Nic::Root : public Genode::Root_component<Loopback_component>
|
||||
|
||||
/*
|
||||
* Check if donated ram quota suffices for both communication
|
||||
* buffers. Also check both sizes separately to handle a
|
||||
* possible overflow of the sum of both sizes.
|
||||
* buffers and check for overflow
|
||||
*/
|
||||
if (tx_buf_size > ram_quota - session_size
|
||||
|| rx_buf_size > ram_quota - session_size
|
||||
|| tx_buf_size + rx_buf_size > ram_quota - session_size) {
|
||||
if (tx_buf_size + rx_buf_size < tx_buf_size ||
|
||||
tx_buf_size + rx_buf_size > ram_quota - session_size) {
|
||||
PERR("insufficient 'ram_quota', got %zd, need %zd",
|
||||
ram_quota, tx_buf_size + rx_buf_size + session_size);
|
||||
throw Root::Quota_exceeded();
|
||||
|
Reference in New Issue
Block a user