/fs/inode: Add checks for NULL pointers as recommended by Junmin Kim <trimind0210@gmail.com>.
This commit is contained in:
parent
abdafaeccc
commit
0ef5500e01
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* fs/inode/fs_filedetach.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2016-2017, 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -114,6 +114,8 @@ int file_detach(int fd, FAR struct file *filep)
|
|||
FAR struct filelist *list;
|
||||
FAR struct file *parent;
|
||||
|
||||
DEBUGASSERT(filep != NULL);
|
||||
|
||||
/* Verify the file descriptor range */
|
||||
|
||||
if (fd < 0 || fd >= CONFIG_NFILE_DESCRIPTORS)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* fs/inode/fs_fileopen.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2018-2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -78,6 +78,8 @@ int file_open(FAR struct file *filep, FAR const char *path, int oflags, ...)
|
|||
int ret;
|
||||
int fd;
|
||||
|
||||
DEBUGASSERT(filep != NULL && path != NULL);
|
||||
|
||||
/* At present, this is just a placeholder. It is just a wrapper around
|
||||
* nx_open() followed by a called to file_detach(). Ideally, this should
|
||||
* a native open function that opens the VFS node directly without using
|
||||
|
|
Loading…
Reference in New Issue