Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1049233imm; Wed, 4 Jul 2018 10:30:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc5rGyb47REmmFlsr62qoh6Hc8ynHTC0T8lbtFAzFcJpU1gQG3O9+w1kxHQmJxeOcPcWetQ X-Received: by 2002:a63:2359:: with SMTP id u25-v6mr2726187pgm.220.1530725446998; Wed, 04 Jul 2018 10:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530725446; cv=none; d=google.com; s=arc-20160816; b=LzYfQ3ijLHgM+Vfxuqog4xZP4d7VCv4pjOC3G99szbFh2cxPP1wIvfGPpb7LEokWkj xe7volJHyjAB0Ch3IgRLLLdX2CSnwsvq7yz6T5t7ufm81ous5UOsbPvqux2uXao6YNzt 39crj5eMI4W9PvLFekRvRXq4HsI0BwaPYKP1kV6kS68SxzsZ1A/pPmD7cbSiesokVJND cqy8VMPWMCkD1L0707pOl1uRmpsRaFOa6H3cGeOj6bD8o5WYIB3lu8JFJT/70XwDrjiF uTIQwaIDfBZAzGz+xBLppDPM7h6OEQQMEY+KIwvPmtZTEgv1SIU9TvfWpRh05NDlnOgP CIxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=ysxcBNHmBG5DiupaDa6tjlXfj4Dbv7xDYOP/Gcynov4=; b=jf7qt3aJKwnjk82JcTfGMY+XaQBAdWq/fgmGln8fZoU3UhQ5VMj/bN3ywIzZAMaUpA mt/KoOZVOglE4bPIEytfTJLXo3t95xaLihCCWLqMmfJiUAcEGnbveIvK7+qG80XbONDh AnPJ7GSgt2o2pXxUYd3zyNytDh4JMtVPBus7TuKdklRzANUOVa2hjHflU+WSjDVnZ1DS YSnjKotvdklrTdDNZmbXf32vykuc8z5nJ3dJKs3OSKERzJ077STf1vavj9pqmxUutugQ brOIg60leR8fp9MFQqDJLv9DpLeS7RvXYojMnGsJ6It3Zb6x92Q2i6lUTF8iTVpka6e5 7tWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="bg/9qx9n"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8-v6si4158439pfi.221.2018.07.04.10.30.32; Wed, 04 Jul 2018 10:30:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="bg/9qx9n"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753335AbeGDR3M (ORCPT + 99 others); Wed, 4 Jul 2018 13:29:12 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:39473 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753015AbeGDR3K (ORCPT ); Wed, 4 Jul 2018 13:29:10 -0400 Received: by mail-pf0-f194.google.com with SMTP id s21-v6so3151689pfm.6 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=CcVD6QSIWSasrPTUhlUloNVpjg7XC2PYYi2UqsrbvV+HlDxTnpaxpw6nblIvYgZqnY ptUCUV7Xk+JiOwdNI9JaaJya4giycn3ih5/Uq9Tmai0GyITd/r+CSESYGg0p+7Yp5yq3 XZxlvHK6rjdoPvk4xbAYQ+CH8Cb1uZDqR6hwd6a92dbjr7+/wqqOYdHzCXgVxVPJAPJI c2DOeX2lvGedGxjmg8wr9vPqM77DPX629+Zz86r5JIyZTe587MHMRNqv+JlO8aHi9Vxz 2SVbIXW+AxF+ZRS8y3xGoBjxf22eLFh+B/IvMjRJYHuJgS207bvZVKA1pvxj1vUvKzns Girw== X-Gm-Message-State: APt69E27MB4WE+LhXE8l+K0W7luMpHZ5fGrjURlF8clJ3Fl3GJETgvXC 8mqE2cNqmwqdZUmTW9/s9ELJDg== 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-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As already done treewide, switch from open-coded multiplication to using 2-factor allocation helpers. Signed-off-by: Kees Cook --- 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) -- 2.17.1 -- Kees Cook Pixel Security