diff mbox series

ionic: Initialize the 'lif->dbid_inuse' bitmap

Message ID 6a478eae0b5e6c63774e1f0ddb1a3f8c38fa8ade.1640527506.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Commit 140c7bc7d1195750342ea0e6ab76179499ae7cd7
Delegated to: Netdev Maintainers
Headers show
Series ionic: Initialize the 'lif->dbid_inuse' bitmap | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Christophe JAILLET Dec. 26, 2021, 2:06 p.m. UTC
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 <christophe.jaillet@wanadoo.fr>
---
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(-)

Comments

Shannon Nelson Dec. 28, 2021, 10:21 p.m. UTC | #1
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 <christophe.jaillet@wanadoo.fr>

Signed-off-by: Shannon Nelson <snelson@pensando.io>

> ---
> 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

> ---
>   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;
patchwork-bot+netdevbpf@kernel.org Dec. 29, 2021, 12:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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 <christophe.jaillet@wanadoo.fr>
> 
> [...]

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!
diff mbox series

Patch

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;