Skip to contentSkip to conversation

platform/mellanox: Use 2-factor allocator calls

PATCH In review Kees Cook 3 participants 3 messages Jul 4, 2018 – Jul 13, 2018

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 platform/mellanox: Use 2-factor allocator calls

As already done treewide, switch from open-coded multiplication to using 2-factor allocation helpers.

---
 drivers/platform/mellanox/mlxreg-io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/mellanox/mlxreg-io.c +2 -2
index c192dfe6bd65..acfaf64ffde6 100644
@@ -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)
Signature · 6 lines
2.17.1


-- 
Kees Cook
Pixel Security
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Kees Cook [mailto:[email protected]]
Sent: Wednesday, July 04, 2018 8:29 PM
To: Darren Hart <[email protected]>
Cc: Vadim Pasternak <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; linux- [email protected]
Subject: [PATCH] platform/mellanox: Use 2-factor allocator calls

Quoted 4 lines

As already done treewide, switch from open-coded multiplication to using 2- factor allocation helpers.

Quoted 27 lines
---
 drivers/platform/mellanox/mlxreg-io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/mellanox/mlxreg-io.c +2 -3
index c192dfe6bd65..acfaf64ffde6 100644
@@ -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

#2 lore raw
Quoted 11 lines · Vadim Pasternak
Quoted 11 lines

-----Original Message-----
From: Kees Cook [mailto:[email protected]]
Sent: Wednesday, July 04, 2018 8:29 PM
To: Darren Hart <[email protected]>
Cc: Vadim Pasternak <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; linux- [email protected]
Subject: [PATCH] platform/mellanox: Use 2-factor allocator calls

Quoted 5 lines
Quoted 4 lines

As already done treewide, switch from open-coded multiplication to using 2- factor allocation helpers.

Pushed to my review and testing queue, thanks!

Quoted 29 lines
Quoted 27 lines
---
 drivers/platform/mellanox/mlxreg-io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/mellanox/mlxreg-io.c +2 -3
index c192dfe6bd65..acfaf64ffde6 100644
@@ -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

Signature · 2 lines
With Best Regards,
Andy Shevchenko