diff options
Diffstat (limited to 'kernel/fs')
-rw-r--r-- | kernel/fs/ext2.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/fs/ext2.c b/kernel/fs/ext2.c index b11bc9c..046408c 100644 --- a/kernel/fs/ext2.c +++ b/kernel/fs/ext2.c @@ -800,8 +800,15 @@ int ext2_create_file(const char *path, int mode) { } vfs_inode_t *ext2_mount(void) { - int fd = vfs_open("/dev/sda", O_RDWR, 0); cache = kcalloc(3000, sizeof(struct BLOCK_CACHE)); + if (!cache) { + return NULL; + } + int fd = vfs_open("/dev/sda", O_RDWR, 0); + if(0 > fd) { + kfree(cache); + return NULL; + } // TODO: Can this be done better? Maybe create a seperate function in // the VFS? mount_fd = get_vfs_fd(fd, NULL); |