未验证 提交 214c1a6d 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #2608 from misonyo/rttdev

[components/dfs]fix index overflow bug when not filesystem was selected
...@@ -444,7 +444,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name) ...@@ -444,7 +444,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
/* lock file system */ /* lock file system */
dfs_lock(); dfs_lock();
/* find the file system operations */ /* 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 && if (filesystem_operation_table[index] != NULL &&
strcmp(filesystem_operation_table[index]->name, fs_name) == 0) strcmp(filesystem_operation_table[index]->name, fs_name) == 0)
...@@ -452,7 +452,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name) ...@@ -452,7 +452,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
} }
dfs_unlock(); dfs_unlock();
if (index <= DFS_FILESYSTEM_TYPES_MAX) if (index < DFS_FILESYSTEM_TYPES_MAX)
{ {
/* find file system operation */ /* find file system operation */
const struct dfs_filesystem_ops *ops = filesystem_operation_table[index]; const struct dfs_filesystem_ops *ops = filesystem_operation_table[index];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册