diff options
author | Undefine <undefine@undefine.pl> | 2023-02-18 21:32:24 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-18 23:52:20 +0100 |
commit | ab298ca106e0d2aba871cf8dae164e8fcfd7f90b (patch) | |
tree | 46e21258d1ad13195fbf4e9701cad3fb3afe676f /Kernel/FileSystem | |
parent | b4113536ef6b4141c004ab008ca7fe9c8e35ed72 (diff) | |
download | serenity-ab298ca106e0d2aba871cf8dae164e8fcfd7f90b.zip |
Kernel: Dont crash if power states gets set to an invalid value
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp index 3d2c1f45da..3f469634ea 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp @@ -57,11 +57,7 @@ ErrorOr<size_t> SysFSPowerStateSwitchNode::write_bytes(off_t offset, size_t coun return Error::from_errno(EINVAL); char buf[1]; TRY(data.read(buf, 1)); - if (buf[0] == '0') - return Error::from_errno(EINVAL); switch (buf[0]) { - case '0': - VERIFY_NOT_REACHED(); case '1': reboot(); VERIFY_NOT_REACHED(); @@ -69,7 +65,7 @@ ErrorOr<size_t> SysFSPowerStateSwitchNode::write_bytes(off_t offset, size_t coun poweroff(); VERIFY_NOT_REACHED(); default: - VERIFY_NOT_REACHED(); + return Error::from_errno(EINVAL); } } |