[PATCH] drm/i915/gvt: Replace duplicated code with exist function

Zhenyu Wang zhenyuw at linux.intel.com
Thu Jul 6 07:20:59 UTC 2017


On 2017.07.04 16:11:16 +0800, Ping Gao wrote:
> Use the exist function intel_gvt_ggtt_validate_range to replace
> these duplicated code that do the same thing.
> 
> Signed-off-by: Ping Gao <ping.a.gao at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> index 7ed8c55..72b97ce 100644
> --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> @@ -1382,13 +1382,13 @@ static inline int cmd_address_audit(struct parser_exec_state *s,
>  			ret = -EINVAL;
>  			goto err;
>  		}
> -	} else if ((!vgpu_gmadr_is_valid(s->vgpu, guest_gma)) ||
> -			(!vgpu_gmadr_is_valid(s->vgpu,
> -					      guest_gma + op_size - 1))) {
> +	} else if (!intel_gvt_ggtt_validate_range(vgpu, guest_gma, op_size)) {
>  		ret = -EINVAL;
>  		goto err;
>  	}
> +
>  	return 0;
> +
>  err:
>  	gvt_vgpu_err("cmd_parser: Malicious %s detected, addr=0x%lx, len=%d!\n",
>  			s->info->name, guest_gma, op_size);
> -- 

applied too, thanks!

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170706/6d9822d8/attachment.sig>


More information about the intel-gvt-dev mailing list