lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHo-OozR_OginBaH3yhwgdQBwxpcqfjakpBC-pOCQO8Bp2vM4g@mail.gmail.com>
Date:	Mon, 26 Mar 2012 22:14:33 -0700
From:	Maciej Żenczykowski <zenczykowski@...il.com>
To:	Linux NetDev <netdev@...r.kernel.org>,
	Vlad Zolotarov <vladz@...adcom.com>
Cc:	Maciej Żenczykowski <maze@...gle.com>
Subject: bnx2x - bnx2x_credit_pool_get_entry bug?

drivers/net/bnx2x/bnx2x_sp.c:3850 contains in bnx2x_credit_pool_get_entry():

last modified in commit: 619c5cb6885b9 Vlad Zolotarov      2011-06-14
14:33:44 +0300

static bool bnx2x_credit_pool_get_entry(
        struct bnx2x_credit_pool_obj *o,
        int *offset)
{
        int idx, vec, i;

        *offset = -1;

        /* Find "internal cam-offset" then add to base for this object... */
        for (vec = 0; vec < BNX2X_POOL_VEC_SIZE; vec++) {

                /* Skip the current vector if there are no free entries in it */
                if (!o->pool_mirror[vec])
                        continue;

                /* If we've got here we are going to find a free entry */
                for (idx = vec * BNX2X_POOL_VEC_SIZE, i = 0;
                      i < BIT_VEC64_ELEM_SZ; idx++, i++)

                        if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) {
                                /* Got one!! */
                                BIT_VEC64_CLEAR_BIT(o->pool_mirror, idx);
                                *offset = o->base_pool_offset + idx;
                                return true;
                        }
        }

        return false;
}

drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h:301:#define
MAX_MAC_CREDIT_E2 272 /* Per Path */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h:640:#define
BNX2X_POOL_VEC_SIZE  (MAX_MAC_CREDIT_E2 / 64)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h:385:#define
BIT_VEC64_ELEM_SZ               64

looks to me like idx = vec * BNX2X_POOL_VEC_SIZE should actually be
idx = vec * BIT_VEC64_ELEM_SZ

Found this while trying to debug an E1 multicast problem in an older
bnx2x driver and looking upstream for inspiration.

- Maciej
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ