Re: [PATCH v2] drm/i915: ensure segment offset never exceeds allowed max

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Krzysztof,

> -	while (offset >= sg_dma_len(r.sgt.sgp) >> PAGE_SHIFT) {
> -		offset -= sg_dma_len(r.sgt.sgp) >> PAGE_SHIFT;
> -		r.sgt = __sgt_iter(__sg_next(r.sgt.sgp), use_dma(iobase));
> -		if (!r.sgt.sgp)
> -			return -EINVAL;
> +	if (r.sgt.curr + (offset << PAGE_SHIFT) < r.sgt.max) {
> +		while (offset >= sg_dma_len(r.sgt.sgp) >> PAGE_SHIFT) {
> +			offset -= sg_dma_len(r.sgt.sgp) >> PAGE_SHIFT;
> +			r.sgt = __sgt_iter(__sg_next(r.sgt.sgp), use_dma(iobase));
> +			if (!r.sgt.sgp)
> +				return -EINVAL;

As we discussed already this would hide the real issue to the
user, eventually add a GEM_WARN_ON(!r.sgt.sgp) here.

Andi



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux