platform_drv(x86): avoid exception in alloc_dma

If size is zero, the platform goes out of service by:

[init -> platform_drv] Error: Uncaught exception of type 'Genode::Ram_allocator::Denied'
[init -> platform_drv] Warning: abort called - thread: e

Issue #4450
This commit is contained in:
Alexander Boettcher 2022-03-08 16:16:52 +01:00 committed by Christian Helmuth
parent dd10e5d977
commit a222df31ba

View File

@ -835,6 +835,9 @@ class Platform::Session_component : public Rpc_object<Session>
if (_env.pd().avail_ram().value < WATERMARK_RAM_QUOTA)
throw Out_of_ram();
if (!size)
return {};
Ram_dataspace_capability ram_cap = _env_ram.alloc(size, cache);
addr_t const dma_addr = _env.pd().dma_addr(ram_cap);