From patchwork Wed Jul 4 17:27:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10509187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0FBC06028F for ; Thu, 5 Jul 2018 13:34:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F37492900C for ; Thu, 5 Jul 2018 13:34:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E78D32901C; Thu, 5 Jul 2018 13:34:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F12B72900C for ; Thu, 5 Jul 2018 13:34:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60D916ED8A; Thu, 5 Jul 2018 13:33:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 961146EC2E for ; Wed, 4 Jul 2018 17:27:32 +0000 (UTC) Received: by mail-pl0-x243.google.com with SMTP id c41-v6so64360plj.10 for ; Wed, 04 Jul 2018 10:27:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=SzLd4PuifEW6TplbKQ3BmovPHZPt1RJMWIXP+2KxwSI=; b=KydJv2Wunyo06Yim1ltRntqId2FjYpaxTtMOjSxXRQR2HvZ5hDVWz0gFvwpzVM73Ps mW102Iscei7VJsgC1gFo7Ba1WPDjirUbXwALqpBZNdDPFUfQ3+63ArFU4GL/AcP5kpCZ 2HAS+zumKhk/xZ336oaLryolQGKa0w/tFLKQ3SXvV/Ri/GfToKV0YEqyc2qSOzFQU4Yd n8d0ybpJV5KNvfwapJLYreWi0GCEyfsiHbkeAq2dukUPFyy2svB2gg/iYfSX9ZDruUDd SznXlujTpjl+uj04JWi7GjBnneUj1eyhSdf2jMNNHjGoRjRgGqttWNWpD4/t3ASIFA9O 2yoQ== X-Gm-Message-State: APt69E2Y56UnsosSVGQ+iKvVMbDQJabK4/z8UAPHPch1md1wO4AZUKP/ Dzz3SixdRpVsgzp8i520II0Uuw== X-Google-Smtp-Source: AAOMgpe2G6xrjkS3y8QMk5EaTQtCQ5wYPm/bh4vjXtWocBahpfMbmscwFs7kgQZr97r8xGwDNfziLg== X-Received: by 2002:a17:902:5501:: with SMTP id f1-v6mr2942884pli.108.1530725252202; Wed, 04 Jul 2018 10:27:32 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id v1-v6sm8670349pfg.101.2018.07.04.10.27.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 10:27:30 -0700 (PDT) Date: Wed, 4 Jul 2018 10:27:30 -0700 From: Kees Cook To: Alex Deucher Subject: [PATCH] drm/amd/display: Use 2-factor allocator calls Message-ID: <20180704172730.GA33562@beast> MIME-Version: 1.0 Content-Disposition: inline X-Mailman-Approved-At: Thu, 05 Jul 2018 13:33:28 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amd-gfx@lists.freedesktop.org, Tony Cheng , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Vitaly Prosyak Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP As already done treewide, switch from open-coded multiplication to 2-factor allocation helper. Signed-off-by: Kees Cook --- drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c index 98edaefa2b47..ee69c949bfbf 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c @@ -1723,8 +1723,8 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans, kvfree(rgb_regamma); } else if (trans == TRANSFER_FUNCTION_HLG || trans == TRANSFER_FUNCTION_HLG12) { - rgb_regamma = kvzalloc(sizeof(*rgb_regamma) * - (MAX_HW_POINTS + _EXTRA_POINTS), + rgb_regamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, + sizeof(*rgb_regamma), GFP_KERNEL); if (!rgb_regamma) goto rgb_regamma_alloc_fail; @@ -1802,8 +1802,8 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans, kvfree(rgb_degamma); } else if (trans == TRANSFER_FUNCTION_HLG || trans == TRANSFER_FUNCTION_HLG12) { - rgb_degamma = kvzalloc(sizeof(*rgb_degamma) * - (MAX_HW_POINTS + _EXTRA_POINTS), + rgb_degamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, + sizeof(*rgb_degamma), GFP_KERNEL); if (!rgb_degamma) goto rgb_degamma_alloc_fail;