summaryrefslogtreecommitdiff
path: root/components/dfs
diff options
context:
space:
mode:
authormisonyo <[email protected]>2019-04-23 23:03:34 +0800
committermisonyo <[email protected]>2019-04-23 23:03:34 +0800
commit958d42f32c0ebf5ab6602979d49217245749fd47 (patch)
tree6df64eac0acf2e9431c9d1999c3fe108d5e64619 /components/dfs
parent54faef99f6785c874c09c8612803c3647c8aa042 (diff)
[components/dfs]fix index overflow bug when not filesystem was selected
Diffstat (limited to 'components/dfs')
-rw-r--r--components/dfs/src/dfs_fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c
index 0f69ad2e3e..04d862e85d 100644
--- a/components/dfs/src/dfs_fs.c
+++ b/components/dfs/src/dfs_fs.c
@@ -444,7 +444,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
/* lock file system */
dfs_lock();
/* find the file system operations */
- for (index = 0; index <= DFS_FILESYSTEM_TYPES_MAX; index ++)
+ for (index = 0; index < DFS_FILESYSTEM_TYPES_MAX; index ++)
{
if (filesystem_operation_table[index] != NULL &&
strcmp(filesystem_operation_table[index]->name, fs_name) == 0)
@@ -452,7 +452,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
}
dfs_unlock();
- if (index <= DFS_FILESYSTEM_TYPES_MAX)
+ if (index < DFS_FILESYSTEM_TYPES_MAX)
{
/* find file system operation */
const struct dfs_filesystem_ops *ops = filesystem_operation_table[index];