Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/drivers/ofw/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ rt_err_t ofw_phandle_hash_reset(rt_phandle min, rt_phandle max)

if (max > _phandle_range[1])
{
rt_size_t size = sizeof(*_phandle_hash) * (max - min);
rt_size_t size = sizeof(*_phandle_hash) * (max - min + 1);

if (!_phandle_hash)
{
Expand All @@ -55,9 +55,11 @@ rt_err_t ofw_phandle_hash_reset(rt_phandle min, rt_phandle max)

if (hash_ptr)
{
rt_size_t old_min = _phandle_range[0];
rt_size_t old_max = _phandle_range[1];
rt_size_t old_count = old_max - old_min + 1;

rt_memset(&hash_ptr[old_max], 0, sizeof(_phandle_hash) * (max - old_max));
rt_memset(&hash_ptr[old_count], 0, size - old_count * sizeof(*_phandle_hash));
}
}
}
Expand Down
Loading