Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/gem: Add check for bitmap_zalloc()
@ 2023-07-28  1:58 Jiasheng Jiang
  2023-07-28  3:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiasheng Jiang @ 2023-07-28  1:58 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, robdclark, lucas.demarchi, thomas.hellstrom,
	chris
  Cc: intel-gfx, Jiasheng Jiang, linux-kernel, dri-devel

Add the check for the return value of bitmap_zalloc() in order to
guarantee the success of the allocation.

Fixes: e9b73c67390a ("drm/i915: Reduce memory pressure during shrinker by preallocating swizzle pages")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/gpu/drm/i915/gem/i915_gem_tiling.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_tiling.c b/drivers/gpu/drm/i915/gem/i915_gem_tiling.c
index a049ca0b7980..e9cf99d95966 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_tiling.c
@@ -311,6 +311,11 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
 		if (!obj->bit_17) {
 			obj->bit_17 = bitmap_zalloc(obj->base.size >> PAGE_SHIFT,
 						    GFP_KERNEL);
+			if (!obj->bit_17) {
+				i915_gem_object_unlock(obj);
+				i915_gem_object_release_mmap_gtt(obj);
+				return -ENOMEM;
+			}
 		}
 	} else {
 		bitmap_free(obj->bit_17);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-28 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28  1:58 [Intel-gfx] [PATCH] drm/i915/gem: Add check for bitmap_zalloc() Jiasheng Jiang
2023-07-28  3:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-07-28  8:06 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
2023-07-28 12:00 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox