All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] drivers:gt:Switch to use kmemdup_array()
@ 2024-08-20  7:45 Yu Jiaoliang
  2024-08-20  7:54 ` Jani Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yu Jiaoliang @ 2024-08-20  7:45 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter, Matt Roper, Andi Shyti,
	Michal Mrozek, Gustavo Sousa, Lucas De Marchi, Tejas Upadhyay,
	Shekhar Chauhan, intel-gfx, dri-devel, linux-kernel
  Cc: opensource.kernel, Yu Jiaoliang

Let the kememdup_array() take care about multiplication and possible
overflows.
Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
---
 drivers/gpu/drm/i915/gt/intel_workarounds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index 09a287c1aedd..d90348c56765 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -111,8 +111,8 @@ static void wa_init_finish(struct i915_wa_list *wal)
 {
 	/* Trim unused entries. */
 	if (!IS_ALIGNED(wal->count, WA_LIST_CHUNK)) {
-		struct i915_wa *list = kmemdup(wal->list,
-					       wal->count * sizeof(*list),
+		struct i915_wa *list = kmemdup_array(wal->list,
+					       wal->count, sizeof(*list),
 					       GFP_KERNEL);
 
 		if (list) {
-- 
2.34.1


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

end of thread, other threads:[~2024-08-20 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20  7:45 [PATCH v1] drivers:gt:Switch to use kmemdup_array() Yu Jiaoliang
2024-08-20  7:54 ` Jani Nikula
2024-08-20  8:18 ` Andi Shyti
2024-08-20 22:32 ` ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.