lkml.org 
[lkml]   [2023]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] gpu/drm/drm_framebuffer.c: Add judgement for return value of drm_get_format_info().
From
Date
Since drm_get_format_info() may return NULL, so a judgement of return
value is needed to add.

Signed-off-by: Peng Hao <penghao@dingdao.com>
---
drivers/gpu/drm/drm_framebuffer.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index aff3746dedfb..be7dd1998c04 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -194,6 +194,10 @@ static int framebuffer_check(struct drm_device *dev,

/* now let the driver pick its own format info */
info = drm_get_format_info(dev, r);
+ if (!info) {
+ drm_dbg_kms(dev, "no matched format info\n");
+ return -EFAULT;
+ }

for (i = 0; i < info->num_planes; i++) {
unsigned int width = fb_plane_width(r->width, info, i);
--
2.37.1
\
 
 \ /
  Last update: 2023-10-27 11:30    [W:0.449 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site