From patchwork Tue Jun 27 14:43:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 13294636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 378B3EB64DC for ; Tue, 27 Jun 2023 14:44:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E46D10E309; Tue, 27 Jun 2023 14:44:01 +0000 (UTC) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73ABC88EFF for ; Tue, 27 Jun 2023 14:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e/q9GJUjVjbhzGKibBqdfdyRa1uJDPYc59CeSzfnNk0=; b=LFjLqDcUJOS8QiGxmMwTJ1y4Iep+0HGsVtpDuCawBY5+SQrzARKEYY+e LpJ/2nlUx2u6cO9WYFeUn5ZI5IackFgqx7NrkFGfOUSrq5MH+vXpPKEWq 4rRq0ltEIc/oqu2mZbmlmaagNsebxFirot+mQAJKsleackI83o/NMh+pZ A=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.01,162,1684792800"; d="scan'208";a="114936320" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 16:43:51 +0200 From: Julia Lawall To: =?utf-8?q?Noralf_Tr=C3=B8nnes?= Subject: [PATCH v2 03/24] drm/gud: use vmalloc_array and vcalloc Date: Tue, 27 Jun 2023 16:43:18 +0200 Message-Id: <20230627144339.144478-4-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230627144339.144478-1-Julia.Lawall@inria.fr> References: <20230627144339.144478-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: keescook@chromium.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, christophe.jaillet@wanadoo.fr, kuba@kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use vmalloc_array and vcalloc to protect against multiplication overflows. The changes were done using the following Coccinelle semantic patch: // @initialize:ocaml@ @@ let rename alloc = match alloc with "vmalloc" -> "vmalloc_array" | "vzalloc" -> "vcalloc" | _ -> failwith "unknown" @@ size_t e1,e2; constant C1, C2; expression E1, E2, COUNT, x1, x2, x3; typedef u8; typedef __u8; type t = {u8,__u8,char,unsigned char}; identifier alloc = {vmalloc,vzalloc}; fresh identifier realloc = script:ocaml(alloc) { rename alloc }; @@ ( alloc(x1*x2*x3) | alloc(C1 * C2) | alloc((sizeof(t)) * (COUNT), ...) | - alloc((e1) * (e2)) + realloc(e1, e2) | - alloc((e1) * (COUNT)) + realloc(COUNT, e1) | - alloc((E1) * (E2)) + realloc(E1, E2) ) // Signed-off-by: Julia Lawall Reviewed-by: Thomas Zimmermann --- v2: Use vmalloc_array and vcalloc instead of array_size. This also leaves a multiplication of a constant by a sizeof as is. Two patches are thus dropped from the series. drivers/gpu/drm/gud/gud_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -u -p a/drivers/gpu/drm/gud/gud_pipe.c b/drivers/gpu/drm/gud/gud_pipe.c --- a/drivers/gpu/drm/gud/gud_pipe.c +++ b/drivers/gpu/drm/gud/gud_pipe.c @@ -390,7 +390,7 @@ static int gud_fb_queue_damage(struct gu mutex_lock(&gdrm->damage_lock); if (!gdrm->shadow_buf) { - gdrm->shadow_buf = vzalloc(fb->pitches[0] * fb->height); + gdrm->shadow_buf = vcalloc(fb->pitches[0], fb->height); if (!gdrm->shadow_buf) { mutex_unlock(&gdrm->damage_lock); return -ENOMEM; From patchwork Tue Jun 27 14:43:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 13294635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EFF4EB64DC for ; Tue, 27 Jun 2023 14:44:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C8D289262; Tue, 27 Jun 2023 14:43:59 +0000 (UTC) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3ABF189101 for ; Tue, 27 Jun 2023 14:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BSv2qibrxL39vitaWqz38N4RpcUIwxJv+1q57KgeapA=; b=orZaBSyF/DmIgjzGMdI3ecENh8T0Rpi5NjDgXjWmm0IiI0c/SJiqga6S Hm93XWBkr0orqShR+FhXfGY6HphUFavxbllc3ygUWsrJxZX7j+aOxBwD3 465HZncpUz2LekQrVlyX8y8k6UOL6NQ6pfoYCkY6Uk8+n9vBNWAKwLPt6 c=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.01,162,1684792800"; d="scan'208";a="114936323" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 16:43:51 +0200 From: Julia Lawall To: Sumit Semwal Subject: [PATCH v2 06/24] dma-buf: system_heap: use vmalloc_array and vcalloc Date: Tue, 27 Jun 2023 16:43:21 +0200 Message-Id: <20230627144339.144478-7-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230627144339.144478-1-Julia.Lawall@inria.fr> References: <20230627144339.144478-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Gaignard , keescook@chromium.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Liam Mark , =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= , linaro-mm-sig@lists.linaro.org, John Stultz , christophe.jaillet@wanadoo.fr, dri-devel@lists.freedesktop.org, kuba@kernel.org, Laura Abbott , linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use vmalloc_array and vcalloc to protect against multiplication overflows. The changes were done using the following Coccinelle semantic patch: // @initialize:ocaml@ @@ let rename alloc = match alloc with "vmalloc" -> "vmalloc_array" | "vzalloc" -> "vcalloc" | _ -> failwith "unknown" @@ size_t e1,e2; constant C1, C2; expression E1, E2, COUNT, x1, x2, x3; typedef u8; typedef __u8; type t = {u8,__u8,char,unsigned char}; identifier alloc = {vmalloc,vzalloc}; fresh identifier realloc = script:ocaml(alloc) { rename alloc }; @@ ( alloc(x1*x2*x3) | alloc(C1 * C2) | alloc((sizeof(t)) * (COUNT), ...) | - alloc((e1) * (e2)) + realloc(e1, e2) | - alloc((e1) * (COUNT)) + realloc(COUNT, e1) | - alloc((E1) * (E2)) + realloc(E1, E2) ) // Signed-off-by: Julia Lawall Acked-by: John Stultz --- v2: Use vmalloc_array and vcalloc instead of array_size. This also leaves a multiplication of a constant by a sizeof as is. Two patches are thus dropped from the series. drivers/dma-buf/heaps/system_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -u -p a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c --- a/drivers/dma-buf/heaps/system_heap.c +++ b/drivers/dma-buf/heaps/system_heap.c @@ -221,7 +221,7 @@ static void *system_heap_do_vmap(struct { struct sg_table *table = &buffer->sg_table; int npages = PAGE_ALIGN(buffer->len) / PAGE_SIZE; - struct page **pages = vmalloc(sizeof(struct page *) * npages); + struct page **pages = vmalloc_array(npages, sizeof(struct page *)); struct page **tmp = pages; struct sg_page_iter piter; void *vaddr; From patchwork Tue Jun 27 14:43:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 13294634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13A1CEB64DD for ; Tue, 27 Jun 2023 14:44:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C0D810E32C; Tue, 27 Jun 2023 14:43:59 +0000 (UTC) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id B0E6A10E2FC for ; Tue, 27 Jun 2023 14:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uOCXLaXRiomt/H0q8utpd2M3e4T7ehi0Ry85QhvtitQ=; b=hZkO1dGIGwuuQTtoKxGsqKTtjf8AmCS3lBjekTBtliF+28pj2YYjyv+d pQuTHMXb9pFINDBs+NiWxzAYZfemeDyybBg1ldmHXdGRE64q83ScGKiPN G4UR3nYmAPZhzU/eZeV1XKOTnDpIYYn37BXMGwHkzCRcoxCLjOYD+NAh6 c=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.01,162,1684792800"; d="scan'208";a="114936338" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 16:43:52 +0200 From: Julia Lawall To: Oded Gabbay Subject: [PATCH v2 15/24] habanalabs: use vmalloc_array and vcalloc Date: Tue, 27 Jun 2023 16:43:30 +0200 Message-Id: <20230627144339.144478-16-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230627144339.144478-1-Julia.Lawall@inria.fr> References: <20230627144339.144478-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: keescook@chromium.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, christophe.jaillet@wanadoo.fr, kuba@kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use vmalloc_array and vcalloc to protect against multiplication overflows. The changes were done using the following Coccinelle semantic patch: // @initialize:ocaml@ @@ let rename alloc = match alloc with "vmalloc" -> "vmalloc_array" | "vzalloc" -> "vcalloc" | _ -> failwith "unknown" @@ size_t e1,e2; constant C1, C2; expression E1, E2, COUNT, x1, x2, x3; typedef u8; typedef __u8; type t = {u8,__u8,char,unsigned char}; identifier alloc = {vmalloc,vzalloc}; fresh identifier realloc = script:ocaml(alloc) { rename alloc }; @@ ( alloc(x1*x2*x3) | alloc(C1 * C2) | alloc((sizeof(t)) * (COUNT), ...) | - alloc((e1) * (e2)) + realloc(e1, e2) | - alloc((e1) * (COUNT)) + realloc(COUNT, e1) | - alloc((E1) * (E2)) + realloc(E1, E2) ) // Signed-off-by: Julia Lawall Reviewed-by: Oded Gabbay --- v2: Use vmalloc_array and vcalloc instead of array_size. This also leaves a multiplication of a constant by a sizeof as is. Two patches are thus dropped from the series. drivers/accel/habanalabs/common/device.c | 3 ++- drivers/accel/habanalabs/common/state_dump.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff -u -p a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -2594,7 +2594,8 @@ static void hl_capture_user_mappings(str */ vfree(pgf_info->user_mappings); pgf_info->user_mappings = - vzalloc(pgf_info->num_of_user_mappings * sizeof(struct hl_user_mapping)); + vcalloc(pgf_info->num_of_user_mappings, + sizeof(struct hl_user_mapping)); if (!pgf_info->user_mappings) { pgf_info->num_of_user_mappings = 0; goto finish; diff -u -p a/drivers/accel/habanalabs/common/state_dump.c b/drivers/accel/habanalabs/common/state_dump.c --- a/drivers/accel/habanalabs/common/state_dump.c +++ b/drivers/accel/habanalabs/common/state_dump.c @@ -272,7 +272,8 @@ static u32 *hl_state_dump_read_sync_obje base_addr = sds->props[SP_SYNC_OBJ_BASE_ADDR] + sds->props[SP_NEXT_SYNC_OBJ_ADDR] * index; - sync_objects = vmalloc(sds->props[SP_SYNC_OBJ_AMOUNT] * sizeof(u32)); + sync_objects = vmalloc_array(sds->props[SP_SYNC_OBJ_AMOUNT], + sizeof(u32)); if (!sync_objects) return NULL; @@ -453,8 +454,8 @@ hl_state_dump_alloc_read_sm_block_monito s64 base_addr; /* Base addr can be negative */ int i; - monitors = vmalloc(sds->props[SP_MONITORS_AMOUNT] * - sizeof(struct hl_mon_state_dump)); + monitors = vmalloc_array(sds->props[SP_MONITORS_AMOUNT], + sizeof(struct hl_mon_state_dump)); if (!monitors) return NULL; From patchwork Tue Jun 27 14:43:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 13294637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05EE3EB64DC for ; Tue, 27 Jun 2023 14:44:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3927810E365; Tue, 27 Jun 2023 14:44:21 +0000 (UTC) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 01B9710E302; Tue, 27 Jun 2023 14:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7lnPTkCHesLh89B4y204QnH5Kjltfl8JZirnUVZstTQ=; b=D48xdhBpfwiIgnA2AZQwT7G8kGdQLMyeE/bNp4/G1WWDhqy1NQswa8ef 9kJySCxs4j0zEvi1o43L6LZHm9SXMOsqjIMXYSNhk/lLG0nKoysVZDATI LGnDCLIO1XSogZ+Tufk5B4mBrsaoHdTlFIQeH85shSvKwrjilzllcylk0 U=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.01,162,1684792800"; d="scan'208";a="114936339" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 16:43:52 +0200 From: Julia Lawall To: Zhenyu Wang Subject: [PATCH v2 16/24] drm/i915/gvt: use vmalloc_array and vcalloc Date: Tue, 27 Jun 2023 16:43:31 +0200 Message-Id: <20230627144339.144478-17-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230627144339.144478-1-Julia.Lawall@inria.fr> References: <20230627144339.144478-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin , keescook@chromium.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, christophe.jaillet@wanadoo.fr, dri-devel@lists.freedesktop.org, Rodrigo Vivi , kuba@kernel.org, Zhi Wang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use vmalloc_array and vcalloc to protect against multiplication overflows. The changes were done using the following Coccinelle semantic patch: // @initialize:ocaml@ @@ let rename alloc = match alloc with "vmalloc" -> "vmalloc_array" | "vzalloc" -> "vcalloc" | _ -> failwith "unknown" @@ size_t e1,e2; constant C1, C2; expression E1, E2, COUNT, x1, x2, x3; typedef u8; typedef __u8; type t = {u8,__u8,char,unsigned char}; identifier alloc = {vmalloc,vzalloc}; fresh identifier realloc = script:ocaml(alloc) { rename alloc }; @@ ( alloc(x1*x2*x3) | alloc(C1 * C2) | alloc((sizeof(t)) * (COUNT), ...) | - alloc((e1) * (e2)) + realloc(e1, e2) | - alloc((e1) * (COUNT)) + realloc(COUNT, e1) | - alloc((E1) * (E2)) + realloc(E1, E2) ) // Signed-off-by: Julia Lawall --- v2: Use vmalloc_array and vcalloc instead of array_size. This also leaves a multiplication of a constant by a sizeof as is. Two patches are thus dropped from the series. drivers/gpu/drm/i915/gvt/gtt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -u -p a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c @@ -1969,14 +1969,16 @@ static struct intel_vgpu_mm *intel_vgpu_ return ERR_PTR(-ENOMEM); } - mm->ggtt_mm.host_ggtt_aperture = vzalloc((vgpu_aperture_sz(vgpu) >> PAGE_SHIFT) * sizeof(u64)); + mm->ggtt_mm.host_ggtt_aperture = vcalloc(vgpu_aperture_sz(vgpu) >> PAGE_SHIFT, + sizeof(u64)); if (!mm->ggtt_mm.host_ggtt_aperture) { vfree(mm->ggtt_mm.virtual_ggtt); vgpu_free_mm(mm); return ERR_PTR(-ENOMEM); } - mm->ggtt_mm.host_ggtt_hidden = vzalloc((vgpu_hidden_sz(vgpu) >> PAGE_SHIFT) * sizeof(u64)); + mm->ggtt_mm.host_ggtt_hidden = vcalloc(vgpu_hidden_sz(vgpu) >> PAGE_SHIFT, + sizeof(u64)); if (!mm->ggtt_mm.host_ggtt_hidden) { vfree(mm->ggtt_mm.host_ggtt_aperture); vfree(mm->ggtt_mm.virtual_ggtt);