mirror of
https://github.com/apache/nuttx.git
synced 2026-10-12 16:50:21 +00:00
fs/mmap: add fd validation to correct errno
MIRTOS-111 Errors EBADF correctly. This is only a quick fix, and a lot needs to be done with mmap(). Change-Id: Ica88360972447fbdd7c6af3bf76d8eeba4747db2 Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
parent
a77d103263
commit
1cd87d6f97
1 changed files with 6 additions and 0 deletions
|
|
@ -140,6 +140,12 @@ FAR void *rammap(int fd, size_t length, off_t offset)
|
|||
|
||||
/* Allocate a region of memory of the specified size */
|
||||
|
||||
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
|
||||
{
|
||||
errcode = EBADF;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
alloc = (FAR uint8_t *)kumm_malloc(sizeof(struct fs_rammap_s) + length);
|
||||
if (!alloc)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue