Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8f9ae9b authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Use range_overflows()

parent edd1f2fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ i915_pages_create_for_stolen(struct drm_device *dev,
	struct sg_table *st;
	struct scatterlist *sg;

	GEM_BUG_ON(offset > dev_priv->ggtt.stolen_size - size);
	GEM_BUG_ON(range_overflows(offset, size, dev_priv->ggtt.stolen_size));

	/* We hide that we have no struct page backing our stolen object
	 * by wrapping the contiguous physical allocation with a fake
+2 −1
Original line number Diff line number Diff line
@@ -403,7 +403,8 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)

	if (flags & PIN_OFFSET_FIXED) {
		u64 offset = flags & PIN_OFFSET_MASK;
		if (offset & (alignment - 1) || offset > end - size) {
		if (offset & (alignment - 1) ||
		    range_overflows(offset, size, end)) {
			ret = -EINVAL;
			goto err_unpin;
		}
+5 −2
Original line number Diff line number Diff line
@@ -1416,13 +1416,16 @@ bool intel_bios_is_valid_vbt(const void *buf, size_t size)
		return false;
	}

	if (vbt->bdb_offset + sizeof(struct bdb_header) > size) {
	if (range_overflows_t(size_t,
			      vbt->bdb_offset,
			      sizeof(struct bdb_header),
			      size)) {
		DRM_DEBUG_DRIVER("BDB header incomplete\n");
		return false;
	}

	bdb = get_bdb_header(vbt);
	if (vbt->bdb_offset + bdb->bdb_size > size) {
	if (range_overflows_t(size_t, vbt->bdb_offset, bdb->bdb_size, size)) {
		DRM_DEBUG_DRIVER("BDB incomplete\n");
		return false;
	}