From patchwork Wed Jul 4 17:29:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10507415 X-Patchwork-Delegate: andy.shevchenko@gmail.com 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 E9C8B600F5 for ; Wed, 4 Jul 2018 17:29:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1482128D60 for ; Wed, 4 Jul 2018 17:29:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08C0528D70; Wed, 4 Jul 2018 17:29:24 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B487128D60 for ; Wed, 4 Jul 2018 17:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753158AbeGDR3L (ORCPT ); Wed, 4 Jul 2018 13:29:11 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34293 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752801AbeGDR3K (ORCPT ); Wed, 4 Jul 2018 13:29:10 -0400 Received: by mail-pf0-f194.google.com with SMTP id e10-v6so3157224pfn.1 for ; Wed, 04 Jul 2018 10:29:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=ysxcBNHmBG5DiupaDa6tjlXfj4Dbv7xDYOP/Gcynov4=; b=bg/9qx9npOgLQwqwJm/GhbfgnEGzRtvwf4QswGfQ8XhWZ8Ml6jdcdcdmIOfCeOeNMv TuzlTvnzZcJm2Js4zguGNXyQ8MhO8Z2gazkOedXbUG5jPeQQImYpjQEqdBrStJ4Pt1VK elDkCDpvkgP2s4rFHuEU5hoSkEfIOtFnFosQ4= 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=ysxcBNHmBG5DiupaDa6tjlXfj4Dbv7xDYOP/Gcynov4=; b=PciQ7Qb0NUvDEYANmeG7szMnC531IstMLxGOrT02Qvea41vLNPhHUxTSSp2BK0CPnm qV0qYau/JMoORjuUlU77duwP2bU5EG23tLKAco+rYBDtteXeuYv/qEmsnK+5YQZQJ/l0 lD5M43SiR957FLVyLHBvmf4a1rv4ORsjx052Priah9yUQ/jYDhTl9DI9gJ6sKNYzi08z PYNrxU8lprCxvD9t1aoiNGkQmNCyey4idgDGyWb3KmUfvermzXHO3i/MP/uGxsAOoQ4S iCA0fJvP3f3qiOvLPBwr3NgckME3g5/NA9hBX51hWT/CwwEwSwPAnCdt3tqgxoA+SRCy uf/A== X-Gm-Message-State: APt69E0zASgZlm+d1BbZxnBb+vtMKcO9U6j81q83J1znpNrojNqMvTWw aLOXBpKGdmMaDWhV5c6PeC0blA== X-Google-Smtp-Source: AAOMgpdQyzGyyeSK2qpPy2uZyv6kc0i20PGaa0iylheGHT1gRYoDsbs6DaVksO8JtSJqu/+g5kgIkw== X-Received: by 2002:a62:5d18:: with SMTP id r24-v6mr3110039pfb.87.1530725350316; Wed, 04 Jul 2018 10:29:10 -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 14-v6sm8834881pft.10.2018.07.04.10.29.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 10:29:09 -0700 (PDT) Date: Wed, 4 Jul 2018 10:29:08 -0700 From: Kees Cook To: Darren Hart Cc: Vadim Pasternak , Andy Shevchenko , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/mellanox: Use 2-factor allocator calls Message-ID: <20180704172908.GA33650@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As already done treewide, switch from open-coded multiplication to using 2-factor allocation helpers. Signed-off-by: Kees Cook Acked-by: Vadim Pasternak --- drivers/platform/mellanox/mlxreg-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c index c192dfe6bd65..acfaf64ffde6 100644 --- a/drivers/platform/mellanox/mlxreg-io.c +++ b/drivers/platform/mellanox/mlxreg-io.c @@ -152,8 +152,8 @@ static int mlxreg_io_attr_init(struct mlxreg_io_priv_data *priv) { int i; - priv->group.attrs = devm_kzalloc(&priv->pdev->dev, - priv->pdata->counter * + priv->group.attrs = devm_kcalloc(&priv->pdev->dev, + priv->pdata->counter, sizeof(struct attribute *), GFP_KERNEL); if (!priv->group.attrs)