Task Description
Many kmalloc calls do not verify whether allocation succeeded. This may lead to undefined behaviour, crashes, or memory corruption when NULL pointers are dereferenced.
Goal
Ensure that every kmalloc invocation is followed by a NULL check.
On failure: return an appropriate error code from errno.h (e.g., -ENOMEM).
Affected Files
src/kernel/resources.c
src/kernel/tty.c
src/kernel/proc.c
src/fs/file.c
src/fs/ramfs.c
src/drivers/ethernet.c
Task Description
Many
kmalloccalls do not verify whether allocation succeeded. This may lead to undefined behaviour, crashes, or memory corruption when NULL pointers are dereferenced.Goal
Ensure that every
kmallocinvocation is followed by a NULL check.On failure: return an appropriate error code from
errno.h(e.g.,-ENOMEM).Affected Files
src/kernel/resources.csrc/kernel/tty.csrc/kernel/proc.csrc/fs/file.csrc/fs/ramfs.csrc/drivers/ethernet.c