From 29f9a38f767ee681a8130314aece5a00651d4b5a Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 18 Jun 2021 11:37:26 +0300 Subject: Kernel: Don't use naked new statements in init process Instead, try to create the device objects in separate static methods, and if we fail for some odd reason to allocate memory for such devices, just panic with that reason. --- Kernel/Devices/FullDevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Kernel/Devices/FullDevice.h') diff --git a/Kernel/Devices/FullDevice.h b/Kernel/Devices/FullDevice.h index 037b4c7308..2fb8d4e785 100644 --- a/Kernel/Devices/FullDevice.h +++ b/Kernel/Devices/FullDevice.h @@ -13,7 +13,7 @@ namespace Kernel { class FullDevice final : public CharacterDevice { AK_MAKE_ETERNAL public: - FullDevice(); + static NonnullRefPtr must_create(); virtual ~FullDevice() override; // ^Device @@ -21,6 +21,8 @@ public: virtual String device_name() const override { return "full"; } private: + FullDevice(); + // ^CharacterDevice virtual KResultOr read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual KResultOr write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; -- cgit v1.2.3