diff mbox series

[CI,1/2] drm/i915/fbdev: fixup setting screen_size

Message ID 20220304095934.925036-1-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [CI,1/2] drm/i915/fbdev: fixup setting screen_size | expand

Commit Message

Matthew Auld March 4, 2022, 9:59 a.m. UTC
Since we are actually mapping the object and not the vma, when dealing
with LMEM, we should be careful and use the backing store size here,
since the vma->node.size could have all kinds of funny padding
constraints, which could result in us writing to OOB address.

v2(Chris):
  - Prefer vma->size here, which should be the backing store size. Some
    more rework is needed here to stop using node.size in some other
    places.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 drivers/gpu/drm/i915/display/intel_fbdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Hellström (Intel) March 4, 2022, 5:22 p.m. UTC | #1
On 3/4/22 10:59, Matthew Auld wrote:
> Since we are actually mapping the object and not the vma, when dealing
> with LMEM, we should be careful and use the backing store size here,
> since the vma->node.size could have all kinds of funny padding
> constraints, which could result in us writing to OOB address.
>
> v2(Chris):
>    - Prefer vma->size here, which should be the backing store size. Some
>      more rework is needed here to stop using node.size in some other
>      places.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>


> ---
>   drivers/gpu/drm/i915/display/intel_fbdev.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 2cd62a187df3..221336178991 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -279,7 +279,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>   		/* Our framebuffer is the entirety of fbdev's system memory */
>   		info->fix.smem_start =
>   			(unsigned long)(ggtt->gmadr.start + vma->node.start);
> -		info->fix.smem_len = vma->node.size;
> +		info->fix.smem_len = vma->size;
>   	}
>   
>   	vaddr = i915_vma_pin_iomap(vma);
> @@ -290,7 +290,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>   		goto out_unpin;
>   	}
>   	info->screen_base = vaddr;
> -	info->screen_size = vma->node.size;
> +	info->screen_size = vma->size;
>   
>   	drm_fb_helper_fill_info(info, &ifbdev->helper, sizes);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 2cd62a187df3..221336178991 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -279,7 +279,7 @@  static int intelfb_create(struct drm_fb_helper *helper,
 		/* Our framebuffer is the entirety of fbdev's system memory */
 		info->fix.smem_start =
 			(unsigned long)(ggtt->gmadr.start + vma->node.start);
-		info->fix.smem_len = vma->node.size;
+		info->fix.smem_len = vma->size;
 	}
 
 	vaddr = i915_vma_pin_iomap(vma);
@@ -290,7 +290,7 @@  static int intelfb_create(struct drm_fb_helper *helper,
 		goto out_unpin;
 	}
 	info->screen_base = vaddr;
-	info->screen_size = vma->node.size;
+	info->screen_size = vma->size;
 
 	drm_fb_helper_fill_info(info, &ifbdev->helper, sizes);