diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2021-08-14 12:39:51 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-15 02:27:13 +0200 |
commit | 748938ea5914383b6b18b7429a219bdcca876d64 (patch) | |
tree | e0d34e022f96b60e1de552c62eccfe5e222eca0d /Kernel/ProcessExposed.h | |
parent | 134dbe2607fecc597b1ad72642f0f26d92677030 (diff) | |
download | serenity-748938ea5914383b6b18b7429a219bdcca876d64.zip |
Kernel: Handle allocation failure in ProcFS and friends
There were many places in which allocation failure was noticed but
ignored.
Diffstat (limited to 'Kernel/ProcessExposed.h')
-rw-r--r-- | Kernel/ProcessExposed.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/ProcessExposed.h b/Kernel/ProcessExposed.h index 85afd01425..5c8b6aba19 100644 --- a/Kernel/ProcessExposed.h +++ b/Kernel/ProcessExposed.h @@ -69,7 +69,7 @@ public: StringView name() const { return m_name->view(); } virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const { VERIFY_NOT_REACHED(); } virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const { VERIFY_NOT_REACHED(); } - virtual RefPtr<ProcFSExposedComponent> lookup(StringView) { VERIFY_NOT_REACHED(); }; + virtual KResultOr<NonnullRefPtr<ProcFSExposedComponent>> lookup(StringView) { VERIFY_NOT_REACHED(); }; virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer&, FileDescription*) { return KResult(EROFS); } virtual size_t size() const { return 0; } @@ -84,7 +84,7 @@ public: return KSuccess; } - virtual NonnullRefPtr<Inode> to_inode(const ProcFS& procfs_instance) const; + virtual KResultOr<NonnullRefPtr<Inode>> to_inode(const ProcFS& procfs_instance) const; virtual InodeIndex component_index() const { return m_component_index; } @@ -106,7 +106,7 @@ class ProcFSExposedDirectory public: virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const override; - virtual RefPtr<ProcFSExposedComponent> lookup(StringView name) override; + virtual KResultOr<NonnullRefPtr<ProcFSExposedComponent>> lookup(StringView name) override; void add_component(const ProcFSExposedComponent&); virtual void prepare_for_deletion() override @@ -117,7 +117,7 @@ public: } virtual mode_t required_mode() const override { return 0555; } - virtual NonnullRefPtr<Inode> to_inode(const ProcFS& procfs_instance) const override final; + virtual KResultOr<NonnullRefPtr<Inode>> to_inode(const ProcFS& procfs_instance) const override final; protected: explicit ProcFSExposedDirectory(StringView name); @@ -128,7 +128,7 @@ protected: class ProcFSExposedLink : public ProcFSExposedComponent { public: - virtual NonnullRefPtr<Inode> to_inode(const ProcFS& procfs_instance) const override final; + virtual KResultOr<NonnullRefPtr<Inode>> to_inode(const ProcFS& procfs_instance) const override final; virtual KResultOr<size_t> read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, FileDescription* description) const override; @@ -142,7 +142,7 @@ class ProcFSRootDirectory final : public ProcFSExposedDirectory { friend class ProcFSComponentRegistry; public: - virtual RefPtr<ProcFSExposedComponent> lookup(StringView name) override; + virtual KResultOr<NonnullRefPtr<ProcFSExposedComponent>> lookup(StringView name) override; static NonnullRefPtr<ProcFSRootDirectory> must_create(); virtual ~ProcFSRootDirectory(); |