From: Denis Bolotin <denis.bolotin@cavium.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <ariel.elior@cavium.com>,
Denis Bolotin <denis.bolotin@cavium.com>,
Michal Kalderon <michal.kalderon@cavium.com>
Subject: [PATCH net 1/2] qed: Fix bitmap_weight() check
Date: Mon, 19 Nov 2018 16:28:30 +0200 [thread overview]
Message-ID: <20181119142831.8035-2-denis.bolotin@cavium.com> (raw)
In-Reply-To: <20181119142831.8035-1-denis.bolotin@cavium.com>
Fix the condition which verifies that only one flag is set. The API
bitmap_weight() should receive size in bits instead of bytes.
Fixes: b5a9ee7cf3be ("qed: Revise QM cofiguration")
Signed-off-by: Denis Bolotin <denis.bolotin@cavium.com>
Signed-off-by: Michal Kalderon <michal.kalderon@cavium.com>
---
drivers/net/ethernet/qlogic/qed/qed_dev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index cff1410..9b41e4b 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -485,8 +485,11 @@ static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn,
struct qed_qm_info *qm_info = &p_hwfn->qm_info;
/* Can't have multiple flags set here */
- if (bitmap_weight((unsigned long *)&pq_flags, sizeof(pq_flags)) > 1)
+ if (bitmap_weight((unsigned long *)&pq_flags,
+ sizeof(pq_flags) * BITS_PER_BYTE) > 1) {
+ DP_ERR(p_hwfn, "requested multiple pq flags 0x%x\n", pq_flags);
goto err;
+ }
switch (pq_flags) {
case PQ_FLAGS_RLS:
--
1.8.3.1
next prev parent reply other threads:[~2018-11-20 0:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 14:28 [PATCH net 0/2] qed: Fix Queue Manager getters Denis Bolotin
2018-11-19 14:28 ` Denis Bolotin [this message]
2018-11-19 14:28 ` [PATCH net 2/2] qed: Fix QM getters to always return a valid pq Denis Bolotin
2018-11-20 2:38 ` [PATCH net 0/2] qed: Fix Queue Manager getters David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181119142831.8035-2-denis.bolotin@cavium.com \
--to=denis.bolotin@cavium.com \
--cc=ariel.elior@cavium.com \
--cc=davem@davemloft.net \
--cc=michal.kalderon@cavium.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox