mshv: Initialize local variables early upon region invalidation
Ensure local variables are initialized before use so that the warning can
print the right values if locking the region to invalidate fails due to
inability to lock the region.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: b9a66cd5cc ("mshv: Add support for movable memory regions")
Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
parent
3a2bcc127e
commit
beb15a6036
|
|
@ -494,13 +494,6 @@ static bool mshv_region_interval_invalidate(struct mmu_interval_notifier *mni,
|
|||
unsigned long mstart, mend;
|
||||
int ret = -EPERM;
|
||||
|
||||
if (mmu_notifier_range_blockable(range))
|
||||
mutex_lock(®ion->mutex);
|
||||
else if (!mutex_trylock(®ion->mutex))
|
||||
goto out_fail;
|
||||
|
||||
mmu_interval_set_seq(mni, cur_seq);
|
||||
|
||||
mstart = max(range->start, region->start_uaddr);
|
||||
mend = min(range->end, region->start_uaddr +
|
||||
(region->nr_pages << HV_HYP_PAGE_SHIFT));
|
||||
|
|
@ -508,6 +501,13 @@ static bool mshv_region_interval_invalidate(struct mmu_interval_notifier *mni,
|
|||
page_offset = HVPFN_DOWN(mstart - region->start_uaddr);
|
||||
page_count = HVPFN_DOWN(mend - mstart);
|
||||
|
||||
if (mmu_notifier_range_blockable(range))
|
||||
mutex_lock(®ion->mutex);
|
||||
else if (!mutex_trylock(®ion->mutex))
|
||||
goto out_fail;
|
||||
|
||||
mmu_interval_set_seq(mni, cur_seq);
|
||||
|
||||
ret = mshv_region_remap_pages(region, HV_MAP_GPA_NO_ACCESS,
|
||||
page_offset, page_count);
|
||||
if (ret)
|
||||
|
|
|
|||
Loading…
Reference in New Issue