Skip to content

Add NULL checks for kmalloc results #1

@atwardzik

Description

@atwardzik

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

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions