[PATCH] ionic: Initialize the 'lif->dbid_inuse' bitmap

Subsystems: networking drivers, pensando ethernet drivers, the rest

STALE1755d LANDED

Landed in mainline as 140c7bc7d119 on 2021-12-29.

3 messages, 3 authors, 2021-12-29 · open the first message on its own page

[PATCH] ionic: Initialize the 'lif->dbid_inuse' bitmap

From: Christophe JAILLET <hidden>
Date: 2021-12-26 14:06:28

When allocated, this bitmap is not initialized. Only the first bit is set a
few lines below.

Use bitmap_zalloc() to make sure that it is cleared before being used.

Fixes: 6461b446f2a0 ("ionic: Add interrupts and doorbells")
Signed-off-by: Christophe JAILLET <redacted>
---
The 'dbid_inuse' bitmap seems to be unused.
So it is certainly better to remove it completely instead of "fixing" it.

Let me know if it is the way to go or if it is there for future use.

If it should be left in place, the corresponding kfree() should also be
replaces by some bitmap_free() to keep consistency.
---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 63f8a8163b5f..2ff7be17e5af 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -3135,7 +3135,7 @@ int ionic_lif_init(struct ionic_lif *lif)
 		return -EINVAL;
 	}
 
-	lif->dbid_inuse = bitmap_alloc(lif->dbid_count, GFP_KERNEL);
+	lif->dbid_inuse = bitmap_zalloc(lif->dbid_count, GFP_KERNEL);
 	if (!lif->dbid_inuse) {
 		dev_err(dev, "Failed alloc doorbell id bitmap, aborting\n");
 		return -ENOMEM;
-- 
2.32.0

Re: [PATCH] ionic: Initialize the 'lif->dbid_inuse' bitmap

From: Shannon Nelson <hidden>
Date: 2021-12-28 22:20:01

On 12/26/21 6:06 AM, Christophe JAILLET wrote:
When allocated, this bitmap is not initialized. Only the first bit is set a
few lines below.

Use bitmap_zalloc() to make sure that it is cleared before being used.

Fixes: 6461b446f2a0 ("ionic: Add interrupts and doorbells")
Signed-off-by: Christophe JAILLET <redacted>
Signed-off-by: Shannon Nelson <redacted>
---
The 'dbid_inuse' bitmap seems to be unused.
So it is certainly better to remove it completely instead of "fixing" it.

Let me know if it is the way to go or if it is there for future use.

If it should be left in place, the corresponding kfree() should also be
replaces by some bitmap_free() to keep consistency.
This looks like one of those small bits that creeps in from the out-of-tree incarnation, is expected to used Real Soon Now, but is not really useful yet.  Yes, this probably should come out until actually useful.  When we get back from the holiday vacations we'll take a closer look at it and make sure we're not causing any unforeseen issues by pulling it out for now.

Thanks,
sln
quoted hunk
---
  drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 63f8a8163b5f..2ff7be17e5af 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -3135,7 +3135,7 @@ int ionic_lif_init(struct ionic_lif *lif)
  		return -EINVAL;
  	}
  
-	lif->dbid_inuse = bitmap_alloc(lif->dbid_count, GFP_KERNEL);
+	lif->dbid_inuse = bitmap_zalloc(lif->dbid_count, GFP_KERNEL);
  	if (!lif->dbid_inuse) {
  		dev_err(dev, "Failed alloc doorbell id bitmap, aborting\n");
  		return -ENOMEM;

Re: [PATCH] ionic: Initialize the 'lif->dbid_inuse' bitmap

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-12-29 00:20:12

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski [off-list ref]:

On Sun, 26 Dec 2021 15:06:17 +0100 you wrote:
When allocated, this bitmap is not initialized. Only the first bit is set a
few lines below.

Use bitmap_zalloc() to make sure that it is cleared before being used.

Fixes: 6461b446f2a0 ("ionic: Add interrupts and doorbells")
Signed-off-by: Christophe JAILLET <redacted>

[...]
Here is the summary with links:
  - ionic: Initialize the 'lif->dbid_inuse' bitmap
    https://git.kernel.org/netdev/net/c/140c7bc7d119

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help