Commit 64d8bb83 authored by Ping Gao's avatar Ping Gao Committed by Zhenyu Wang

drm/i915/gvt: Replace duplicated code with exist function

Use the exist function intel_gvt_ggtt_validate_range to replace
these duplicated code that do the same thing.
Signed-off-by: default avatarPing Gao <ping.a.gao@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 87e919d7
...@@ -1382,13 +1382,13 @@ static inline int cmd_address_audit(struct parser_exec_state *s, ...@@ -1382,13 +1382,13 @@ static inline int cmd_address_audit(struct parser_exec_state *s,
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
} else if ((!vgpu_gmadr_is_valid(s->vgpu, guest_gma)) || } else if (!intel_gvt_ggtt_validate_range(vgpu, guest_gma, op_size)) {
(!vgpu_gmadr_is_valid(s->vgpu,
guest_gma + op_size - 1))) {
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
return 0; return 0;
err: err:
gvt_vgpu_err("cmd_parser: Malicious %s detected, addr=0x%lx, len=%d!\n", gvt_vgpu_err("cmd_parser: Malicious %s detected, addr=0x%lx, len=%d!\n",
s->info->name, guest_gma, op_size); s->info->name, guest_gma, op_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment