Merge pull request #2608 from misonyo/rttdev

[components/dfs]fix index overflow bug when not filesystem was selected
This commit is contained in:
Bernard Xiong 2019-04-24 21:15:42 +08:00 committed by GitHub
commit 214c1a6d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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];