[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1645455221-38580-1-git-send-email-lyz_cs@pku.edu.cn>
Date: Mon, 21 Feb 2022 06:53:41 -0800
From: Yongzhi Liu <lyz_cs@....edu.cn>
To: jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, tvrtko.ursulin@...ux.intel.com,
airlied@...ux.ie, daniel@...ll.ch,
thomas.hellstrom@...ux.intel.com,
maarten.lankhorst@...ux.intel.com, matthew.auld@...el.com,
matthew.d.roper@...el.com, lyz_cs@....edu.cn, tzimmermann@...e.de,
michal.winiarski@...el.com
Cc: intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] drm/i915: Check input parameter for NULL
[why]
i915_gem_object_put_pages_phys() frees pages and standard
pattern is to allow caller to not care if it's
NULL or not. This will reduce burden on
the callers to perform this check.
[how]
Fix it by adding Null check.
Signed-off-by: Yongzhi Liu <lyz_cs@....edu.cn>
---
drivers/gpu/drm/i915/gem/i915_gem_phys.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_phys.c b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
index ca6faff..5445f41 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_phys.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
@@ -95,6 +95,8 @@ void
i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
struct sg_table *pages)
{
+ if (!pages)
+ return;
dma_addr_t dma = sg_dma_address(pages->sgl);
void *vaddr = sg_page(pages->sgl);
--
2.7.4
Powered by blists - more mailing lists