| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/09/08 02:06 | flow | patch-triage |
2mArgs:null Results: {
"EnableConfigs": [
"PHYLIB",
"USB_RTL8152",
"TEST_BITMAP"
],
"FocusSymbols": [
"__bitmap_and",
"__bitmap_and_and",
"__bitmap_and_andnot",
"phy_ethtool_ksettings_set",
"genphy_c45_eee_is_active",
"r8152_get_eee",
"r8153_get_eee"
],
"KMSANReasoning": "The patch introduces new bitmap helpers (bitmap_and_and, bitmap_and_andnot, linkmode_and_and, linkmode_and_andnot), updates linkmode_and to return a boolean indicating whether the resulting mask is non-empty, and updates various network drivers and PHY library call sites to use these combined helpers.\n\nThese changes strictly perform bitwise operations on existing bitmaps and fully overwrite the destination bitmasks in both small (\u003c BITS_PER_LONG) and multi-word configurations. The patch does not introduce or modify copy-to-user interfaces, uninitialized variable usage, structure padding, or partial initializations. Standard sanitizers (such as KASAN) and unit tests (selftests in lib/test_bitmap.c) are sufficient for validating bounds and bitwise correctness. Therefore, dedicated KMSAN fuzzing is not required.",
"NeedsKMSAN": false,
"Reasoning": "The patch refactors the core bitmap AND operations in lib/bitmap.c and introduces new bitmap and linkmode primitives (__bitmap_and_and, __bitmap_and_andnot, bitmap_and_and, linkmode_and, linkmode_and_and, linkmode_and_andnot), along with updating call sites in phylib, network drivers, and USB network drivers. These paths are reachable via standard network/ethtool ioctls, netlink requests, and USB emulation in virtualized fuzzing environments.",
"WorthFuzzing": true
} |
| 1/1 | 2026/09/08 02:06 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 2a3ff52999cd9b098395fecb7a7a6cf16ef1b644\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Tue Sep 8 02:06:40 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/MAINTAINERS b/MAINTAINERS\nindex 3a19da74d00c9..b78f0bccff545 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -4646,6 +4646,7 @@ F:\tinclude/linux/cpumask.h\n F:\tinclude/linux/cpumask_types.h\n F:\tinclude/linux/find.h\n F:\tinclude/linux/hw_bitfield.h\n+F:\tinclude/linux/linkmode.h\n F:\tinclude/linux/nodemask.h\n F:\tinclude/linux/nodemask_types.h\n F:\tinclude/uapi/linux/bits.h\ndiff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c\nindex a9f4fcc4daae3..113a108559386 100644\n--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c\n+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c\n@@ -231,6 +231,7 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,\n \tstruct xgbe_prv_data *pdata = netdev_priv(netdev);\n \tstruct ethtool_link_ksettings *lks = \u0026pdata-\u003ephy.lks;\n \t__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);\n+\tbool has_advertising;\n \tu32 speed;\n \tint ret;\n \n@@ -267,11 +268,11 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,\n \t\t __ETHTOOL_LINK_MODE_MASK_NBITS, cmd-\u003elink_modes.advertising,\n \t\t __ETHTOOL_LINK_MODE_MASK_NBITS, lks-\u003elink_modes.supported);\n \n-\tlinkmode_and(advertising, cmd-\u003elink_modes.advertising,\n-\t\t lks-\u003elink_modes.supported);\n+\thas_advertising = linkmode_and(advertising,\n+\t\t\t\t cmd-\u003elink_modes.advertising,\n+\t\t\t\t lks-\u003elink_modes.supported);\n \n-\tif ((cmd-\u003ebase.autoneg == AUTONEG_ENABLE) \u0026\u0026\n-\t bitmap_empty(advertising, __ETHTOOL_LINK_MODE_MASK_NBITS)) {\n+\tif (!has_advertising \u0026\u0026 cmd-\u003ebase.autoneg == AUTONEG_ENABLE) {\n \t\tnetdev_err(netdev,\n \t\t\t \"unsupported requested advertisement\\n\");\n \t\treturn -EINVAL;\ndiff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c\nindex cf881108fa570..5801da6100b8b 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c\n@@ -205,7 +205,6 @@ int hclge_mac_connect_phy(struct hnae3_handle *handle)\n \tstruct hclge_dev *hdev = vport-\u003eback;\n \tstruct net_device *netdev = hdev-\u003evport[0].nic.netdev;\n \tstruct phy_device *phydev = hdev-\u003ehw.mac.phydev;\n-\t__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };\n \tint ret;\n \n \tif (!phydev)\n@@ -223,8 +222,8 @@ int hclge_mac_connect_phy(struct hnae3_handle *handle)\n \t\treturn ret;\n \t}\n \n-\tlinkmode_copy(mask, hdev-\u003ehw.mac.supported);\n-\tlinkmode_and(phydev-\u003esupported, phydev-\u003esupported, mask);\n+\tlinkmode_and(phydev-\u003esupported, phydev-\u003esupported,\n+\t\t hdev-\u003ehw.mac.supported);\n \tlinkmode_copy(phydev-\u003eadvertising, phydev-\u003esupported);\n \n \t/* supported flag is Pause and Asym Pause, but default advertising\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c\nindex 36e43b5e88d1f..a7b7f89f29e42 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c\n@@ -3751,8 +3751,7 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata)\n \tedata-\u003eeee_enabled = !linkmode_empty(edata-\u003eadvertised);\n \tedata-\u003etx_lpi_enabled = edata-\u003eeee_enabled;\n \n-\tlinkmode_and(common, edata-\u003eadvertised, edata-\u003elp_advertised);\n-\tedata-\u003eeee_active = !linkmode_empty(common);\n+\tedata-\u003eeee_active = linkmode_and(common, edata-\u003eadvertised, edata-\u003elp_advertised);\n \n \treturn 0;\n }\ndiff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c\nindex 870920311f9a0..27da1b9ddbc58 100644\n--- a/drivers/net/phy/phy-c45.c\n+++ b/drivers/net/phy/phy-c45.c\n@@ -1623,8 +1623,7 @@ int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *lp)\n \tif (lp)\n \t\tlinkmode_copy(lp, tmp_lp);\n \n-\tlinkmode_and(common, phydev-\u003eadvertising_eee, tmp_lp);\n-\tif (linkmode_empty(common))\n+\tif (!linkmode_and(common, phydev-\u003eadvertising_eee, tmp_lp))\n \t\treturn 0;\n \n \treturn phy_check_valid(phydev-\u003espeed, phydev-\u003eduplex, common);\ndiff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c\nindex fce9bc7be3304..cd71186cd8424 100644\n--- a/drivers/net/phy/phy.c\n+++ b/drivers/net/phy/phy.c\n@@ -1160,6 +1160,7 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,\n \t\t\t const struct ethtool_link_ksettings *cmd)\n {\n \t__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);\n+\tbool has_advertising;\n \tu8 autoneg = cmd-\u003ebase.autoneg;\n \tu8 duplex = cmd-\u003ebase.duplex;\n \tu32 speed = cmd-\u003ebase.speed;\n@@ -1167,17 +1168,15 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,\n \tif (cmd-\u003ebase.phy_address != phydev-\u003emdio.addr)\n \t\treturn -EINVAL;\n \n-\tlinkmode_copy(advertising, cmd-\u003elink_modes.advertising);\n-\n \t/* We make sure that we don't pass unsupported values in to the PHY */\n-\tlinkmode_and(advertising, advertising, phydev-\u003esupported);\n+\thas_advertising = linkmode_and(advertising, cmd-\u003elink_modes.advertising, phydev-\u003esupported);\n \n \t/* Verify the settings we care about. */\n \tif (autoneg != AUTONEG_ENABLE \u0026\u0026 autoneg != AUTONEG_DISABLE)\n \t\treturn -EINVAL;\n \n \tif (autoneg == AUTONEG_ENABLE \u0026\u0026\n-\t (linkmode_empty(advertising) ||\n+\t (!has_advertising ||\n \t !linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,\n \t\t\t\tphydev-\u003esupported)))\n \t\treturn -EINVAL;\ndiff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c\nindex 94b2e85e00a37..3430605695c50 100644\n--- a/drivers/net/phy/phy_device.c\n+++ b/drivers/net/phy/phy_device.c\n@@ -1565,8 +1565,7 @@ static int phy_sfp_module_insert(void *upstream, const struct sfp_eeprom_id *id)\n \n \tcaps = sfp_get_module_caps(phydev-\u003esfp_bus);\n \n-\tlinkmode_and(sfp_support, port-\u003esupported, caps-\u003elink_modes);\n-\tif (linkmode_empty(sfp_support)) {\n+\tif (!linkmode_and(sfp_support, port-\u003esupported, caps-\u003elink_modes)) {\n \t\tdev_err(\u0026phydev-\u003emdio.dev, \"incompatible SFP module inserted, no common linkmode\\n\");\n \t\treturn -EINVAL;\n \t}\n@@ -3761,15 +3760,14 @@ static int phy_probe(struct device *dev)\n \t/* Some PHYs may advertise, by default, not support EEE modes. So,\n \t * we need to clean them. In addition remove all disabled EEE modes.\n \t */\n-\tlinkmode_and(phydev-\u003eadvertising_eee, phydev-\u003esupported_eee,\n-\t\t phydev-\u003eadvertising_eee);\n-\tlinkmode_andnot(phydev-\u003eadvertising_eee, phydev-\u003eadvertising_eee,\n-\t\t\tphydev-\u003eeee_disabled_modes);\n-\n \t/* There is no \"enabled\" flag. If PHY is advertising, assume it is\n \t * kind of enabled.\n \t */\n-\tphydev-\u003eeee_cfg.eee_enabled = !linkmode_empty(phydev-\u003eadvertising_eee);\n+\tphydev-\u003eeee_cfg.eee_enabled =\n+\t\tlinkmode_and_andnot(phydev-\u003eadvertising_eee,\n+\t\t\t\t phydev-\u003eadvertising_eee,\n+\t\t\t\t phydev-\u003esupported_eee,\n+\t\t\t\t phydev-\u003eeee_disabled_modes);\n \n \t/* Get master/slave strap overrides */\n \tof_set_phy_timing_role(phydev);\ndiff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c\nindex f61686433031c..75f0574fe1d4a 100644\n--- a/drivers/net/usb/r8152.c\n+++ b/drivers/net/usb/r8152.c\n@@ -9149,9 +9149,8 @@ static int r8152_get_eee(struct r8152 *tp, struct ethtool_keee *eee)\n \tif (speed \u0026 _100bps)\n \t\tlinkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, common);\n \n-\tlinkmode_and(common, common, eee-\u003eadvertised);\n-\tlinkmode_and(common, common, eee-\u003elp_advertised);\n-\teee-\u003eeee_active = !linkmode_empty(common);\n+\teee-\u003eeee_active = linkmode_and_and(common, common, eee-\u003eadvertised,\n+\t\t\t\t\t eee-\u003elp_advertised);\n \n \treturn 0;\n }\n@@ -9222,9 +9221,8 @@ static int r8153_get_eee(struct r8152 *tp, struct ethtool_keee *eee)\n \tif (speed \u0026 _100bps)\n \t\tlinkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, common);\n \n-\tlinkmode_and(common, common, eee-\u003eadvertised);\n-\tlinkmode_and(common, common, eee-\u003elp_advertised);\n-\teee-\u003eeee_active = !linkmode_empty(common);\n+\teee-\u003eeee_active = linkmode_and_and(common, common, eee-\u003eadvertised,\n+\t\t\t\t\t eee-\u003elp_advertised);\n \n \treturn 0;\n }\ndiff --git a/include/linux/bitmap.h b/include/linux/bitmap.h\nindex 7df1573a409c3..d524ef6b0300b 100644\n--- a/include/linux/bitmap.h\n+++ b/include/linux/bitmap.h\n@@ -44,6 +44,10 @@ struct device;\n * bitmap_fill(dst, nbits) *dst = ~0UL\n * bitmap_copy(dst, src, nbits) *dst = *src\n * bitmap_and(dst, src1, src2, nbits) *dst = *src1 \u0026 *src2\n+ * bitmap_and_and(dst, src1, src2, src3, nbits)\n+ * *dst = *src1 \u0026 *src2 \u0026 *src3\n+ * bitmap_and_andnot(dst, src1, src2, src3, nbits)\n+ * *dst = *src1 \u0026 *src2 \u0026 ~(*src3)\n * bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2\n * bitmap_weighted_or(dst, src1, src2, nbits)\t*dst = *src1 | *src2. Returns Hamming Weight of dst\n * bitmap_weighted_xor(dst, src1, src2, nbits)\t*dst = *src1 ^ *src2. Returns Hamming Weight of dst\n@@ -166,6 +170,12 @@ void bitmap_cut(unsigned long *dst, const unsigned long *src,\n \t\tunsigned int first, unsigned int cut, unsigned int nbits);\n bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,\n \t\t const unsigned long *bitmap2, unsigned int nbits);\n+bool __bitmap_and_and(unsigned long *dst, const unsigned long *bitmap1,\n+\t\t const unsigned long *bitmap2,\n+\t\t const unsigned long *bitmap3, unsigned int nbits);\n+bool __bitmap_and_andnot(unsigned long *dst, const unsigned long *bitmap1,\n+\t\t\t const unsigned long *bitmap2,\n+\t\t\t const unsigned long *bitmap3, unsigned int nbits);\n void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,\n \t\t const unsigned long *bitmap2, unsigned int nbits);\n unsigned int __bitmap_weighted_or(unsigned long *dst, const unsigned long *bitmap1,\n@@ -337,6 +347,28 @@ bool bitmap_and(unsigned long *dst, const unsigned long *src1,\n \treturn __bitmap_and(dst, src1, src2, nbits);\n }\n \n+static __always_inline\n+bool bitmap_and_and(unsigned long *dst, const unsigned long *src1,\n+\t\t const unsigned long *src2, const unsigned long *src3,\n+\t\t unsigned int nbits)\n+{\n+\tif (small_const_nbits(nbits))\n+\t\treturn (*dst = *src1 \u0026 *src2 \u0026 *src3 \u0026\n+\t\t\t BITMAP_LAST_WORD_MASK(nbits)) != 0;\n+\treturn __bitmap_and_and(dst, src1, src2, src3, nbits);\n+}\n+\n+static __always_inline\n+bool bitmap_and_andnot(unsigned long *dst, const unsigned long *src1,\n+\t\t const unsigned long *src2, const unsigned long *src3,\n+\t\t unsigned int nbits)\n+{\n+\tif (small_const_nbits(nbits))\n+\t\treturn (*dst = *src1 \u0026 *src2 \u0026 ~(*src3) \u0026\n+\t\t\t BITMAP_LAST_WORD_MASK(nbits)) != 0;\n+\treturn __bitmap_and_andnot(dst, src1, src2, src3, nbits);\n+}\n+\n static __always_inline\n void bitmap_or(unsigned long *dst, const unsigned long *src1,\n \t const unsigned long *src2, unsigned int nbits)\ndiff --git a/include/linux/linkmode.h b/include/linux/linkmode.h\nindex 3b9de09871f60..efd392dc62ae9 100644\n--- a/include/linux/linkmode.h\n+++ b/include/linux/linkmode.h\n@@ -20,10 +20,27 @@ static inline void linkmode_copy(unsigned long *dst, const unsigned long *src)\n \tbitmap_copy(dst, src, __ETHTOOL_LINK_MODE_MASK_NBITS);\n }\n \n-static inline void linkmode_and(unsigned long *dst, const unsigned long *a,\n+static inline bool linkmode_and(unsigned long *dst, const unsigned long *a,\n \t\t\t\tconst unsigned long *b)\n {\n-\tbitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);\n+\treturn bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);\n+}\n+\n+static inline bool linkmode_and_and(unsigned long *dst,\n+\t\t\t\t const unsigned long *a,\n+\t\t\t\t const unsigned long *b,\n+\t\t\t\t const unsigned long *c)\n+{\n+\treturn bitmap_and_and(dst, a, b, c, __ETHTOOL_LINK_MODE_MASK_NBITS);\n+}\n+\n+static inline bool linkmode_and_andnot(unsigned long *dst,\n+\t\t\t\t const unsigned long *a,\n+\t\t\t\t const unsigned long *b,\n+\t\t\t\t const unsigned long *c)\n+{\n+\treturn bitmap_and_andnot(dst, a, b, c,\n+\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS);\n }\n \n static inline void linkmode_or(unsigned long *dst, const unsigned long *a,\ndiff --git a/lib/bitmap.c b/lib/bitmap.c\nindex ed685127a1073..85ce3cbaa9ab9 100644\n--- a/lib/bitmap.c\n+++ b/lib/bitmap.c\n@@ -34,6 +34,25 @@\n * for the best explanations of this ordering.\n */\n \n+/*\n+ * Common helper for bitmap operations.\n+ * @FETCH: The expression that fetches and combines each word of the bitmaps\n+ * @bits: The bitmap size in bits\n+ */\n+#define BITMAP_OP(FETCH, bits)\t\t\t\t\t\t\t\\\n+({\t\t\t\t\t\t\t\t\t\t\\\n+\tunsigned long idx, val, sz = (bits), result = 0;\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\t\\\n+\tfor (idx = 0; idx * BITS_PER_LONG \u003c sz; idx++) {\t\t\t\\\n+\t\tval = (FETCH);\t\t\t\t\t\t\t\\\n+\t\tif (sz - idx * BITS_PER_LONG \u003c BITS_PER_LONG)\t\t\\\n+\t\t\tval \u0026= BITMAP_LAST_WORD_MASK(sz);\t\t\t\\\n+\t\tresult |= (dst[idx] = val);\t\t\t\t\t\\\n+\t}\t\t\t\t\t\t\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\t\\\n+\tresult != 0;\t\t\t\t\t\t\t\t\\\n+})\n+\n bool __bitmap_equal(const unsigned long *bitmap1,\n \t\t const unsigned long *bitmap2, unsigned int bits)\n {\n@@ -230,19 +249,26 @@ EXPORT_SYMBOL(bitmap_cut);\n bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,\n \t\t\t\tconst unsigned long *bitmap2, unsigned int bits)\n {\n-\tunsigned int k;\n-\tunsigned int lim = bits/BITS_PER_LONG;\n-\tunsigned long result = 0;\n-\n-\tfor (k = 0; k \u003c lim; k++)\n-\t\tresult |= (dst[k] = bitmap1[k] \u0026 bitmap2[k]);\n-\tif (bits % BITS_PER_LONG)\n-\t\tresult |= (dst[k] = bitmap1[k] \u0026 bitmap2[k] \u0026\n-\t\t\t BITMAP_LAST_WORD_MASK(bits));\n-\treturn result != 0;\n+\treturn BITMAP_OP(bitmap1[idx] \u0026 bitmap2[idx], bits);\n }\n EXPORT_SYMBOL(__bitmap_and);\n \n+bool __bitmap_and_and(unsigned long *dst, const unsigned long *bitmap1,\n+\t\t const unsigned long *bitmap2,\n+\t\t const unsigned long *bitmap3, unsigned int bits)\n+{\n+\treturn BITMAP_OP(bitmap1[idx] \u0026 bitmap2[idx] \u0026 bitmap3[idx], bits);\n+}\n+EXPORT_SYMBOL(__bitmap_and_and);\n+\n+bool __bitmap_and_andnot(unsigned long *dst, const unsigned long *bitmap1,\n+\t\t\t const unsigned long *bitmap2,\n+\t\t\t const unsigned long *bitmap3, unsigned int bits)\n+{\n+\treturn BITMAP_OP(bitmap1[idx] \u0026 bitmap2[idx] \u0026 ~bitmap3[idx], bits);\n+}\n+EXPORT_SYMBOL(__bitmap_and_andnot);\n+\n void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,\n \t\t\t\tconst unsigned long *bitmap2, unsigned int bits)\n {\ndiff --git a/lib/test_bitmap.c b/lib/test_bitmap.c\nindex 56bd23059b26a..fbc46ed960a4f 100644\n--- a/lib/test_bitmap.c\n+++ b/lib/test_bitmap.c\n@@ -193,6 +193,81 @@ static void __init test_zero_clear(void)\n \texpect_eq_pbl(\"\", bmap, 1024);\n }\n \n+static void __init test_bitmap_and(void)\n+{\n+\tenum { nbits = BITS_PER_LONG + 13 };\n+\tDECLARE_BITMAP(src1, nbits);\n+\tDECLARE_BITMAP(src2, nbits);\n+\tDECLARE_BITMAP(src3, nbits);\n+\tDECLARE_BITMAP(dst, nbits);\n+\tDECLARE_BITMAP(expected, nbits);\n+\tunsigned long small_src1 = ~0UL;\n+\tunsigned long small_src2 = ~0UL;\n+\tunsigned long small_src3 = BIT(2);\n+\tunsigned long small_dst;\n+\tbool ret;\n+\n+\tret = bitmap_and_and(\u0026small_dst, \u0026small_src1, \u0026small_src2,\n+\t\t\t \u0026small_src3, 4);\n+\texpect_eq_ulong(true, ret);\n+\texpect_eq_ulong(BIT(2), small_dst);\n+\n+\tret = bitmap_and_andnot(\u0026small_dst, \u0026small_src1, \u0026small_src2,\n+\t\t\t\t\u0026small_src3, 4);\n+\texpect_eq_ulong(true, ret);\n+\texpect_eq_ulong(GENMASK(3, 0) \u0026 ~BIT(2), small_dst);\n+\n+\tbitmap_zero(src1, nbits);\n+\tbitmap_zero(src2, nbits);\n+\tbitmap_zero(src3, nbits);\n+\tbitmap_zero(expected, nbits);\n+\t__set_bit(1, src1);\n+\t__set_bit(2, src1);\n+\t__set_bit(BITS_PER_LONG + 1, src1);\n+\t__set_bit(BITS_PER_LONG + 12, src1);\n+\t__set_bit(BITS_PER_LONG + 13, src1);\n+\t__set_bit(1, src2);\n+\t__set_bit(BITS_PER_LONG + 1, src2);\n+\t__set_bit(BITS_PER_LONG + 12, src2);\n+\t__set_bit(BITS_PER_LONG + 13, src2);\n+\t__set_bit(BITS_PER_LONG + 1, src3);\n+\t__set_bit(1, expected);\n+\t__set_bit(BITS_PER_LONG + 1, expected);\n+\t__set_bit(BITS_PER_LONG + 12, expected);\n+\n+\tret = bitmap_and(dst, src1, src2, nbits);\n+\texpect_eq_ulong(true, ret);\n+\texpect_eq_bitmap(expected, dst, nbits);\n+\texpect_eq_ulong(BIT(1) | BIT(12), dst[1]);\n+\n+\tbitmap_zero(expected, nbits);\n+\t__set_bit(BITS_PER_LONG + 1, expected);\n+\tret = bitmap_and_and(dst, src1, src2, src3, nbits);\n+\texpect_eq_ulong(true, ret);\n+\texpect_eq_bitmap(expected, dst, nbits);\n+\texpect_eq_ulong(BIT(1), dst[1]);\n+\n+\tbitmap_zero(expected, nbits);\n+\t__set_bit(1, expected);\n+\t__set_bit(2, expected);\n+\t__set_bit(BITS_PER_LONG + 12, expected);\n+\tret = bitmap_andnot(dst, src1, src3, nbits);\n+\texpect_eq_ulong(true, ret);\n+\texpect_eq_bitmap(expected, dst, nbits);\n+\texpect_eq_ulong(BIT(12), dst[1]);\n+\n+\t__clear_bit(2, expected);\n+\tret = bitmap_and_andnot(src2, src1, src2, src3, nbits);\n+\texpect_eq_ulong(true, ret);\n+\texpect_eq_bitmap(expected, src2, nbits);\n+\texpect_eq_ulong(BIT(12), src2[1]);\n+\n+\tbitmap_fill(src3, nbits);\n+\tret = bitmap_and_andnot(src2, src1, src2, src3, nbits);\n+\texpect_eq_ulong(false, ret);\n+\texpect_eq_pbl(\"\", src2, nbits);\n+}\n+\n static void __init test_find_nth_bit(void)\n {\n \tunsigned long b, bit, cnt = 0;\n@@ -1533,6 +1608,8 @@ static void __init test_zero_nbits(void)\n \tbitmap_zero(NULL, 0);\n \n \tret = bitmap_and(NULL, NULL, NULL, 0);\n+\tret = bitmap_and_and(NULL, NULL, NULL, NULL, 0);\n+\tret = bitmap_and_andnot(NULL, NULL, NULL, NULL, 0);\n \tret = bitmap_empty(NULL, 0);\n \tret = bitmap_equal(NULL, NULL, 0);\n \tret = bitmap_full(NULL, 0);\n@@ -1566,6 +1643,7 @@ static void __init test_zero_nbits(void)\n static void __init selftest(void)\n {\n \ttest_zero_clear();\n+\ttest_bitmap_and();\n \ttest_fill_set();\n \ttest_copy();\n \ttest_bitmap_region();\n"
} |
| 2/1 | 2026/09/08 02:06 | agent | patch-evaluator |
0mModel:core Args: null Results: {
"EnableConfigs": [
"PHYLIB",
"USB_RTL8152",
"TEST_BITMAP"
],
"FocusSymbols": [
"__bitmap_and",
"__bitmap_and_and",
"__bitmap_and_andnot",
"phy_ethtool_ksettings_set",
"genphy_c45_eee_is_active",
"r8152_get_eee",
"r8153_get_eee"
],
"Reasoning": "The patch refactors the core bitmap AND operations in lib/bitmap.c and introduces new bitmap and linkmode primitives (__bitmap_and_and, __bitmap_and_andnot, bitmap_and_and, linkmode_and, linkmode_and_and, linkmode_and_andnot), along with updating call sites in phylib, network drivers, and USB network drivers. These paths are reachable via standard network/ethtool ioctls, netlink requests, and USB emulation in virtualized fuzzing environments.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 2a3ff52999cd9b098395fecb7a7a6cf16ef1b644
Author: syz-cluster <triage@syzkaller.com>
Date: Tue Sep 8 02:06:40 2026 +0000
syz-cluster: applied patch under review
diff --git a/MAINTAINERS b/MAINTAINERS
index 3a19da74d00c9..b78f0bccff545 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4646,6 +4646,7 @@ F: include/linux/cpumask.h
F: include/linux/cpumask_types.h
F: include/linux/find.h
F: include/linux/hw_bitfield.h
+F: include/linux/linkmode.h
F: include/linux/nodemask.h
F: include/linux/nodemask_types.h
F: include/uapi/linux/bits.h
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index a9f4fcc4daae3..113a108559386 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -231,6 +231,7 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
struct xgbe_prv_data *pdata = netdev_priv(netdev);
struct ethtool_link_ksettings *lks = &pdata->phy.lks;
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
+ bool has_advertising;
u32 speed;
int ret;
@@ -267,11 +268,11 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
__ETHTOOL_LINK_MODE_MASK_NBITS, cmd->link_modes.advertising,
__ETHTOOL_LINK_MODE_MASK_NBITS, lks->link_modes.supported);
- linkmode_and(advertising, cmd->link_modes.advertising,
- lks->link_modes.supported);
+ has_advertising = linkmode_and(advertising,
+ cmd->link_modes.advertising,
+ lks->link_modes.supported);
- if ((cmd->base.autoneg == AUTONEG_ENABLE) &&
- bitmap_empty(advertising, __ETHTOOL_LINK_MODE_MASK_NBITS)) {
+ if (!has_advertising && cmd->base.autoneg == AUTONEG_ENABLE) {
netdev_err(netdev,
"unsupported requested advertisement\n");
return -EINVAL;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
index cf881108fa570..5801da6100b8b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
@@ -205,7 +205,6 @@ int hclge_mac_connect_phy(struct hnae3_handle *handle)
struct hclge_dev *hdev = vport->back;
struct net_device *netdev = hdev->vport[0].nic.netdev;
struct phy_device *phydev = hdev->hw.mac.phydev;
- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
int ret;
if (!phydev)
@@ -223,8 +222,8 @@ int hclge_mac_connect_phy(struct hnae3_handle *handle)
return ret;
}
- linkmode_copy(mask, hdev->hw.mac.supported);
- linkmode_and(phydev->supported, phydev->supported, mask);
+ linkmode_and(phydev->supported, phydev->supported,
+ hdev->hw.mac.supported);
linkmode_copy(phydev->advertising, phydev->supported);
/* supported flag is Pause and Asym Pause, but default advertising
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 36e43b5e88d1f..a7b7f89f29e42 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -3751,8 +3751,7 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata)
edata->eee_enabled = !linkmode_empty(edata->advertised);
edata->tx_lpi_enabled = edata->eee_enabled;
- linkmode_and(common, edata->advertised, edata->lp_advertised);
- edata->eee_active = !linkmode_empty(common);
+ edata->eee_active = linkmode_and(common, edata->advertised, edata->lp_advertised);
return 0;
}
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 870920311f9a0..27da1b9ddbc58 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -1623,8 +1623,7 @@ int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *lp)
if (lp)
linkmode_copy(lp, tmp_lp);
- linkmode_and(common, phydev->advertising_eee, tmp_lp);
- if (linkmode_empty(common))
+ if (!linkmode_and(common, phydev->advertising_eee, tmp_lp))
return 0;
return phy_check_valid(phydev->speed, phydev->duplex, common);
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index fce9bc7be3304..cd71186cd8424 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1160,6 +1160,7 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
const struct ethtool_link_ksettings *cmd)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
+ bool has_advertising;
u8 autoneg = cmd->base.autoneg;
u8 duplex = cmd->base.duplex;
u32 speed = cmd->base.speed;
@@ -1167,17 +1168,15 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
if (cmd->base.phy_address != phydev->mdio.addr)
return -EINVAL;
- linkmode_copy(advertising, cmd->link_modes.advertising);
-
/* We make sure that we don't pass unsupported values in to the PHY */
- linkmode_and(advertising, advertising, phydev->supported);
+ has_advertising = linkmode_and(advertising, cmd->link_modes.advertising, phydev->supported);
/* Verify the settings we care about. */
if (autoneg != AUTONEG_ENABLE && autoneg != AUTONEG_DISABLE)
return -EINVAL;
if (autoneg == AUTONEG_ENABLE &&
- (linkmode_empty(advertising) ||
+ (!has_advertising ||
!linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
phydev->supported)))
return -EINVAL;
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 94b2e85e00a37..3430605695c50 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1565,8 +1565,7 @@ static int phy_sfp_module_insert(void *upstream, const struct sfp_eeprom_id *id)
caps = sfp_get_module_caps(phydev->sfp_bus);
- linkmode_and(sfp_support, port->supported, caps->link_modes);
- if (linkmode_empty(sfp_support)) {
+ if (!linkmode_and(sfp_support, port->supported, caps->link_modes)) {
dev_err(&phydev->mdio.dev, "incompatible SFP module inserted, no common linkmode\n");
return -EINVAL;
}
@@ -3761,15 +3760,14 @@ static int phy_probe(struct device *dev)
/* Some PHYs may advertise, by default, not support EEE modes. So,
* we need to clean them. In addition remove all disabled EEE modes.
*/
- linkmode_and(phydev->advertising_eee, phydev->supported_eee,
- phydev->advertising_eee);
- linkmode_andnot(phydev->advertising_eee, phydev->advertising_eee,
- phydev->eee_disabled_modes);
-
/* There is no "enabled" flag. If PHY is advertising, assume it is
* kind of enabled.
*/
- phydev->eee_cfg.eee_enabled = !linkmode_empty(phydev->advertising_eee);
+ phydev->eee_cfg.eee_enabled =
+ linkmode_and_andnot(phydev->advertising_eee,
+ phydev->advertising_eee,
+ phydev->supported_eee,
+ phydev->eee_disabled_modes);
/* Get master/slave strap overrides */
of_set_phy_timing_role(phydev);
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index f61686433031c..75f0574fe1d4a 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -9149,9 +9149,8 @@ static int r8152_get_eee(struct r8152 *tp, struct ethtool_keee *eee)
if (speed & _100bps)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, common);
- linkmode_and(common, common, eee->advertised);
- linkmode_and(common, common, eee->lp_advertised);
- eee->eee_active = !linkmode_empty(common);
+ eee->eee_active = linkmode_and_and(common, common, eee->advertised,
+ eee->lp_advertised);
return 0;
}
@@ -9222,9 +9221,8 @@ static int r8153_get_eee(struct r8152 *tp, struct ethtool_keee *eee)
if (speed & _100bps)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, common);
- linkmode_and(common, common, eee->advertised);
- linkmode_and(common, common, eee->lp_advertised);
- eee->eee_active = !linkmode_empty(common);
+ eee->eee_active = linkmode_and_and(common, common, eee->advertised,
+ eee->lp_advertised);
return 0;
}
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7df1573a409c3..d524ef6b0300b 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -44,6 +44,10 @@ struct device;
* bitmap_fill(dst, nbits) *dst = ~0UL
* bitmap_copy(dst, src, nbits) *dst = *src
* bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2
+ * bitmap_and_and(dst, src1, src2, src3, nbits)
+ * *dst = *src1 & *src2 & *src3
+ * bitmap_and_andnot(dst, src1, src2, src3, nbits)
+ * *dst = *src1 & *src2 & ~(*src3)
* bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2
* bitmap_weighted_or(dst, src1, src2, nbits) *dst = *src1 | *src2. Returns Hamming Weight of dst
* bitmap_weighted_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2. Returns Hamming Weight of dst
@@ -166,6 +170,12 @@ void bitmap_cut(unsigned long *dst, const unsigned long *src,
unsigned int first, unsigned int cut, unsigned int nbits);
bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int nbits);
+bool __bitmap_and_and(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int nbits);
+bool __bitmap_and_andnot(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int nbits);
void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int nbits);
unsigned int __bitmap_weighted_or(unsigned long *dst, const unsigned long *bitmap1,
@@ -337,6 +347,28 @@ bool bitmap_and(unsigned long *dst, const unsigned long *src1,
return __bitmap_and(dst, src1, src2, nbits);
}
+static __always_inline
+bool bitmap_and_and(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, const unsigned long *src3,
+ unsigned int nbits)
+{
+ if (small_const_nbits(nbits))
+ return (*dst = *src1 & *src2 & *src3 &
+ BITMAP_LAST_WORD_MASK(nbits)) != 0;
+ return __bitmap_and_and(dst, src1, src2, src3, nbits);
+}
+
+static __always_inline
+bool bitmap_and_andnot(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, const unsigned long *src3,
+ unsigned int nbits)
+{
+ if (small_const_nbits(nbits))
+ return (*dst = *src1 & *src2 & ~(*src3) &
+ BITMAP_LAST_WORD_MASK(nbits)) != 0;
+ return __bitmap_and_andnot(dst, src1, src2, src3, nbits);
+}
+
static __always_inline
void bitmap_or(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, unsigned int nbits)
diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h
index 3b9de09871f60..efd392dc62ae9 100644
--- a/include/linux/linkmode.h
+++ b/include/linux/linkmode.h
@@ -20,10 +20,27 @@ static inline void linkmode_copy(unsigned long *dst, const unsigned long *src)
bitmap_copy(dst, src, __ETHTOOL_LINK_MODE_MASK_NBITS);
}
-static inline void linkmode_and(unsigned long *dst, const unsigned long *a,
+static inline bool linkmode_and(unsigned long *dst, const unsigned long *a,
const unsigned long *b)
{
- bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ return bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);
+}
+
+static inline bool linkmode_and_and(unsigned long *dst,
+ const unsigned long *a,
+ const unsigned long *b,
+ const unsigned long *c)
+{
+ return bitmap_and_and(dst, a, b, c, __ETHTOOL_LINK_MODE_MASK_NBITS);
+}
+
+static inline bool linkmode_and_andnot(unsigned long *dst,
+ const unsigned long *a,
+ const unsigned long *b,
+ const unsigned long *c)
+{
+ return bitmap_and_andnot(dst, a, b, c,
+ __ETHTOOL_LINK_MODE_MASK_NBITS);
}
static inline void linkmode_or(unsigned long *dst, const unsigned long *a,
diff --git a/lib/bitmap.c b/lib/bitmap.c
index ed685127a1073..85ce3cbaa9ab9 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -34,6 +34,25 @@
* for the best explanations of this ordering.
*/
+/*
+ * Common helper for bitmap operations.
+ * @FETCH: The expression that fetches and combines each word of the bitmaps
+ * @bits: The bitmap size in bits
+ */
+#define BITMAP_OP(FETCH, bits) \
+({ \
+ unsigned long idx, val, sz = (bits), result = 0; \
+ \
+ for (idx = 0; idx * BITS_PER_LONG < sz; idx++) { \
+ val = (FETCH); \
+ if (sz - idx * BITS_PER_LONG < BITS_PER_LONG) \
+ val &= BITMAP_LAST_WORD_MASK(sz); \
+ result |= (dst[idx] = val); \
+ } \
+ \
+ result != 0; \
+})
+
bool __bitmap_equal(const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int bits)
{
@@ -230,19 +249,26 @@ EXPORT_SYMBOL(bitmap_cut);
bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int bits)
{
- unsigned int k;
- unsigned int lim = bits/BITS_PER_LONG;
- unsigned long result = 0;
-
- for (k = 0; k < lim; k++)
- result |= (dst[k] = bitmap1[k] & bitmap2[k]);
- if (bits % BITS_PER_LONG)
- result |= (dst[k] = bitmap1[k] & bitmap2[k] &
- BITMAP_LAST_WORD_MASK(bits));
- return result != 0;
+ return BITMAP_OP(bitmap1[idx] & bitmap2[idx], bits);
}
EXPORT_SYMBOL(__bitmap_and);
+bool __bitmap_and_and(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int bits)
+{
+ return BITMAP_OP(bitmap1[idx] & bitmap2[idx] & bitmap3[idx], bits);
+}
+EXPORT_SYMBOL(__bitmap_and_and);
+
+bool __bitmap_and_andnot(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int bits)
+{
+ return BITMAP_OP(bitmap1[idx] & bitmap2[idx] & ~bitmap3[idx], bits);
+}
+EXPORT_SYMBOL(__bitmap_and_andnot);
+
void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int bits)
{
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 56bd23059b26a..fbc46ed960a4f 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -193,6 +193,81 @@ static void __init test_zero_clear(void)
expect_eq_pbl("", bmap, 1024);
}
+static void __init test_bitmap_and(void)
+{
+ enum { nbits = BITS_PER_LONG + 13 };
+ DECLARE_BITMAP(src1, nbits);
+ DECLARE_BITMAP(src2, nbits);
+ DECLARE_BITMAP(src3, nbits);
+ DECLARE_BITMAP(dst, nbits);
+ DECLARE_BITMAP(expected, nbits);
+ unsigned long small_src1 = ~0UL;
+ unsigned long small_src2 = ~0UL;
+ unsigned long small_src3 = BIT(2);
+ unsigned long small_dst;
+ bool ret;
+
+ ret = bitmap_and_and(&small_dst, &small_src1, &small_src2,
+ &small_src3, 4);
+ expect_eq_ulong(true, ret);
+ expect_eq_ulong(BIT(2), small_dst);
+
+ ret = bitmap_and_andnot(&small_dst, &small_src1, &small_src2,
+ &small_src3, 4);
+ expect_eq_ulong(true, ret);
+ expect_eq_ulong(GENMASK(3, 0) & ~BIT(2), small_dst);
+
+ bitmap_zero(src1, nbits);
+ bitmap_zero(src2, nbits);
+ bitmap_zero(src3, nbits);
+ bitmap_zero(expected, nbits);
+ __set_bit(1, src1);
+ __set_bit(2, src1);
+ __set_bit(BITS_PER_LONG + 1, src1);
+ __set_bit(BITS_PER_LONG + 12, src1);
+ __set_bit(BITS_PER_LONG + 13, src1);
+ __set_bit(1, src2);
+ __set_bit(BITS_PER_LONG + 1, src2);
+ __set_bit(BITS_PER_LONG + 12, src2);
+ __set_bit(BITS_PER_LONG + 13, src2);
+ __set_bit(BITS_PER_LONG + 1, src3);
+ __set_bit(1, expected);
+ __set_bit(BITS_PER_LONG + 1, expected);
+ __set_bit(BITS_PER_LONG + 12, expected);
+
+ ret = bitmap_and(dst, src1, src2, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, dst, nbits);
+ expect_eq_ulong(BIT(1) | BIT(12), dst[1]);
+
+ bitmap_zero(expected, nbits);
+ __set_bit(BITS_PER_LONG + 1, expected);
+ ret = bitmap_and_and(dst, src1, src2, src3, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, dst, nbits);
+ expect_eq_ulong(BIT(1), dst[1]);
+
+ bitmap_zero(expected, nbits);
+ __set_bit(1, expected);
+ __set_bit(2, expected);
+ __set_bit(BITS_PER_LONG + 12, expected);
+ ret = bitmap_andnot(dst, src1, src3, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, dst, nbits);
+ expect_eq_ulong(BIT(12), dst[1]);
+
+ __clear_bit(2, expected);
+ ret = bitmap_and_andnot(src2, src1, src2, src3, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, src2, nbits);
+ expect_eq_ulong(BIT(12), src2[1]);
+
+ bitmap_fill(src3, nbits);
+ ret = bitmap_and_andnot(src2, src1, src2, src3, nbits);
+ expect_eq_ulong(false, ret);
+ expect_eq_pbl("", src2, nbits);
+}
+
static void __init test_find_nth_bit(void)
{
unsigned long b, bit, cnt = 0;
@@ -1533,6 +1608,8 @@ static void __init test_zero_nbits(void)
bitmap_zero(NULL, 0);
ret = bitmap_and(NULL, NULL, NULL, 0);
+ ret = bitmap_and_and(NULL, NULL, NULL, NULL, 0);
+ ret = bitmap_and_andnot(NULL, NULL, NULL, NULL, 0);
ret = bitmap_empty(NULL, 0);
ret = bitmap_equal(NULL, NULL, 0);
ret = bitmap_full(NULL, 0);
@@ -1566,6 +1643,7 @@ static void __init test_zero_nbits(void)
static void __init selftest(void)
{
test_zero_clear();
+ test_bitmap_and();
test_fill_set();
test_copy();
test_bitmap_region();
|
| 3/2 | 2026/09/08 02:06 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 9616 output: 27 thoughts: 1152 Thoughts: **Fuzzing Feasibility Analysis: Bitmap and Linkmode Patch Series** Okay, let's break this down. My initial assessment is that this patch series warrants a closer look for fuzzing with syzkaller. Here's my thought process: First, understanding the changes: The core of the changes revolve around bitmap manipulation functions in `lib/bitmap.c` and their declarations in `include/linux/bitmap.h` and also `include/linux/linkmode.h`. Specifically, we've got new helpers like `bitmap_and_and`, `bitmap_and_andnot`, and similar `linkmode_*` functions. We've got core refactoring here (`__bitmap_and` and related functions using `BITMAP_OP`). New test cases are added, which is a good sign. The critical part is that call sites are modified in network drivers such as AMD XGBE, Intel ixgbe, Realtek r8152 and various PHY drivers. Now, considering the reachability principle of fuzzing, I'm thinking: The changes in `lib/bitmap.c` and the `include/linux/*` headers are core abstractions that could be touched in some subsystems. Particularly the `lib/` directory is an important area. Refactorings, especially in core helpers, are red flags. The network drivers being modified, especially the USB ethernet drivers like the Realtek ones (r8152, r8153), are excellent candidates because of their reachability via standard virtualized environments. PHY drivers are also interesting. The `__bitmap_and` function, in particular, looks interesting because of the conditional logic: `if (small_const_nbits(nbits))`. This means `__bitmap_and` can be reached. The function `bitmap_and` returns a boolean but uses bitwise operations. This is a core helper abstraction and could be a point of vulnerability. This is a good starting point for evaluating coverage. The `nbits` variable is potentially variable, so we might have an interesting fuzzing target here. Let me check `__ETHTOOL_LINK_MODE_MASK_NBITS`. If that's not a compile time constant or bigger than `BITS_PER_LONG`, that would allow us to call `__bitmap_and`. |
| 4/2 | 2026/09/08 02:06 | tool | grepper |
0mArgs:{
"Expression": "__ETHTOOL_LINK_MODE_MASK_NBITS"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 676 lines.\nUse more precise expression if possible.\n\ndrivers/leds/trigger/ledtrig-netdev.c=534=static umode_t netdev_trig_link_speed_visible(struct kobject *kobj,\n--\ndrivers/leds/trigger/ledtrig-netdev.c-549-\t */\ndrivers/leds/trigger/ledtrig-netdev.c:550:\tfor_each_set_bit(mode, supported_link_modes, __ETHTOOL_LINK_MODE_MASK_NBITS) {\ndrivers/leds/trigger/ledtrig-netdev.c-551-\t\tstruct ethtool_link_ksettings link_ksettings;\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-ethtool.c=228=static int xgbe_set_link_ksettings(struct net_device *netdev,\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-ethtool.c-267-\t\t \"requested advertisement 0x%*pb, phy supported 0x%*pb\\n\",\ndrivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:268:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, cmd-\u003elink_modes.advertising,\ndrivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:269:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, lks-\u003elink_modes.supported);\ndrivers/net/ethernet/amd/xgbe/xgbe-ethtool.c-270-\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c=3428=static int xgbe_phy_init(struct xgbe_prv_data *pdata)\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3673-\t\tdev_dbg(pdata-\u003edev, \"phy supported=0x%*pb\\n\",\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:3674:\t\t\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3675-\t\t\tlks-\u003elink_modes.supported);\n--\ndrivers/net/ethernet/amd/xgbe/xgbe.h-253-\t\t (_src)-\u003elink_modes._sname,\t\t\\\ndrivers/net/ethernet/amd/xgbe/xgbe.h:254:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS)\ndrivers/net/ethernet/amd/xgbe/xgbe.h-255-\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c=10307=static void hclge_get_link_mode(struct hnae3_handle *handle,\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c-10310-{\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:10311:\tunsigned int size = BITS_TO_LONGS(__ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c-10312-\tstruct hclge_vport *vport = hclge_get_vport(handle);\n--\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c=212=static void hinic3_add_speed_link_mode(unsigned long *bitmap, u32 mode)\n--\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c-217-\t\tif (hw2ethtool_link_mode_table[mode].link_mode_bit_arr[i] \u003e=\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c:218:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS)\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c-219-\t\t\tcontinue;\n--\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c=385=hinic3_get_link_ksettings(struct net_device *netdev,\n--\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c-399-\tbitmap_copy(link_settings-\u003elink_modes.supported, settings.supported,\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c:400:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c-401-\tbitmap_copy(link_settings-\u003elink_modes.advertising, settings.advertising,\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c:402:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c-403-\n--\ndrivers/net/ethernet/intel/i40e/i40e_ethtool.c=1221=static int i40e_set_link_ksettings(struct net_device *netdev,\n--\ndrivers/net/ethernet/intel/i40e/i40e_ethtool.c-1283-\t\t\t safe_ks.link_modes.supported,\ndrivers/net/ethernet/intel/i40e/i40e_ethtool.c:1284:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS))\ndrivers/net/ethernet/intel/i40e/i40e_ethtool.c-1285-\t\treturn -EINVAL;\n--\ndrivers/net/ethernet/intel/ice/ice_ethtool.c=2606=ice_set_link_ksettings(struct net_device *netdev,\n--\ndrivers/net/ethernet/intel/ice/ice_ethtool.c-2660-\t\t\t safe_ks.link_modes.supported,\ndrivers/net/ethernet/intel/ice/ice_ethtool.c:2661:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS)) {\ndrivers/net/ethernet/intel/ice/ice_ethtool.c-2662-\t\tif (!test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf-\u003eflags))\n--\ndrivers/net/ethernet/marvell/octeon_ep/octep_ethtool.c=318=static int octep_set_link_ksettings(struct net_device *netdev,\n--\ndrivers/net/ethernet/marvell/octeon_ep/octep_ethtool.c-345-\t\t\t cmd-\u003elink_modes.supported,\ndrivers/net/ethernet/marvell/octeon_ep/octep_ethtool.c:346:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS))\ndrivers/net/ethernet/marvell/octeon_ep/octep_ethtool.c-347-\t\treturn -EINVAL;\n--\ndrivers/net/ethernet/marvell/octeontx2/af/cgx.c=1507=int cgx_set_link_mode(void *cgxd, struct cgx_set_link_mode_args args,\n--\ndrivers/net/ethernet/marvell/octeontx2/af/cgx.c-1518-\tfor_each_set_bit(bit, args.advertising,\ndrivers/net/ethernet/marvell/octeontx2/af/cgx.c:1519:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS)\ndrivers/net/ethernet/marvell/octeontx2/af/cgx.c-1520-\t\totx2_map_ethtool_link_modes(bit, \u0026args);\n--\ndrivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c=1237=static int otx2_set_link_ksettings(struct net_device *netdev,\n--\ndrivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c-1288-\tif (bitmap_weight(req-\u003eargs.advertising,\ndrivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:1289:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS) \u003e= 2)\ndrivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c-1290-\t\treq-\u003eargs.multimode = true;\n--\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c=226=static const struct prestera_port_type {\n--\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c-230-\t[PRESTERA_PORT_TYPE_NONE] = {\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c:231:\t\t.eth_mode = __ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c-232-\t\t.eth_type = PORT_NONE,\n--\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c-258-\t[PRESTERA_PORT_TYPE_OTHER] = {\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c:259:\t\t.eth_mode = __ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c-260-\t\t.eth_type = PORT_OTHER,\n--\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c=428=static void prestera_port_remote_cap_get(struct ethtool_link_ksettings *ecmd,\n--\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c-449-\tif (!bitmap_empty(ecmd-\u003elink_modes.lp_advertising,\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c:450:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS)) {\ndrivers/net/ethernet/marvell/prestera/prestera_ethtool.c-451-\t\tethtool_link_ksettings_add_link_mode(ecmd,\n--\ndrivers/net/ethernet/mellanox/mlx4/en_ethtool.c=898=mlx4_en_set_link_ksettings(struct net_device *dev,\n--\ndrivers/net/ethernet/mellanox/mlx4/en_ethtool.c-912-\t \"Set Speed=%d adv={%*pbl} autoneg=%d duplex=%d\\n\",\ndrivers/net/ethernet/mellanox/mlx4/en_ethtool.c:913:\t speed, __ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/ethernet/mellanox/mlx4/en_ethtool.c-914-\t link_ksettings-\u003elink_modes.advertising,\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c=87=struct ptys2ethtool_config ptys2ext_ethtool_table[MLX5E_EXT_LINK_MODES_NUMBER];\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-95-\t\tbitmap_zero(cfg-\u003esupported, \\\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:96:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS); \\\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-97-\t\tbitmap_zero(cfg-\u003eadvertised, \\\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:98:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS); \\\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-99-\t\tfor (i = 0 ; i \u003c ARRAY_SIZE(modes) ; ++i) { \\\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c=965=static void ptys2ethtool_process_link(u32 eth_eproto, bool ext, bool advertised,\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-977-\t\t\t table[proto].advertised : table[proto].supported,\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:978:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-979-}\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c=1352=static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1357-\t\tif (bitmap_empty(ptys2legacy_ethtool_table[i].advertised,\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1358:\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS))\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1359-\t\t\tcontinue;\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1361-\t\t\t\t link_modes,\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1362:\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS))\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1363-\t\t\tptys_modes |= MLX5E_PROT_MASK(i);\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c=1369=static u32 mlx5e_ethtool2ptys_ext_adver_link(const unsigned long *link_modes)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1375-\t\tif (bitmap_empty(ptys2ext_ethtool_table[i].advertised,\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1376:\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS))\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1377-\t\t\tcontinue;\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1378:\t\tbitmap_zero(modes, __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1379-\t\tbitmap_and(modes, ptys2ext_ethtool_table[i].advertised,\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1380:\t\t\t link_modes, __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1381-\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1382-\t\tif (bitmap_equal(modes, ptys2ext_ethtool_table[i].advertised,\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1383:\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS))\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1384-\t\t\tptys_modes |= MLX5E_PROT_MASK(i);\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c=1389=static bool ext_link_mode_requested(const unsigned long *adver)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1391-#define MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT ETHTOOL_LINK_MODE_50000baseKR_Full_BIT\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1392:\tint size = __ETHTOOL_LINK_MODE_MASK_NBITS - MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT;\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1393-\t__ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = {0,};\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1395-\tbitmap_set(modes, MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT, size);\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:1396:\treturn bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c-1397-}\n--\ndrivers/net/ethernet/qlogic/qede/qede_ethtool.c=1821=static int qede_set_eee(struct net_device *dev, struct ethtool_keee *edata)\n--\ndrivers/net/ethernet/qlogic/qede/qede_ethtool.c-1854-\t\t\t \"Invalid advertised capabilities %*pb\\n\",\ndrivers/net/ethernet/qlogic/qede/qede_ethtool.c:1855:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, edata-\u003eadvertised);\ndrivers/net/ethernet/qlogic/qede/qede_ethtool.c-1856-\t\treturn -EINVAL;\n--\ndrivers/net/ethernet/sfc/efx_common.c=458=void efx_link_clear_advertising(struct efx_nic *efx)\ndrivers/net/ethernet/sfc/efx_common.c-459-{\ndrivers/net/ethernet/sfc/efx_common.c:460:\tbitmap_zero(efx-\u003elink_advertising, __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/sfc/efx_common.c-461-\tefx-\u003ewanted_fc \u0026= ~(EFX_FC_TX | EFX_FC_RX);\n--\ndrivers/net/ethernet/sfc/mcdi_port_common.c=112=void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset)\n--\ndrivers/net/ethernet/sfc/mcdi_port_common.c-116-\ndrivers/net/ethernet/sfc/mcdi_port_common.c:117:\tbitmap_zero(linkset, __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/sfc/mcdi_port_common.c-118-\tswitch (media) {\n--\ndrivers/net/ethernet/sfc/siena/efx_common.c=462=void efx_siena_link_clear_advertising(struct efx_nic *efx)\ndrivers/net/ethernet/sfc/siena/efx_common.c-463-{\ndrivers/net/ethernet/sfc/siena/efx_common.c:464:\tbitmap_zero(efx-\u003elink_advertising, __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/sfc/siena/efx_common.c-465-\tefx-\u003ewanted_fc \u0026= ~(EFX_FC_TX | EFX_FC_RX);\n--\ndrivers/net/ethernet/sfc/siena/mcdi_port_common.c=113=static void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset)\n--\ndrivers/net/ethernet/sfc/siena/mcdi_port_common.c-117-\ndrivers/net/ethernet/sfc/siena/mcdi_port_common.c:118:\tbitmap_zero(linkset, __ETHTOOL_LINK_MODE_MASK_NBITS);\ndrivers/net/ethernet/sfc/siena/mcdi_port_common.c-119-\tswitch (media) {\n--\ndrivers/net/pcs/pcs-xpcs.c=22=static const int xpcs_usxgmii_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-29-\tETHTOOL_LINK_MODE_2500baseX_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:30:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-31-};\n--\ndrivers/net/pcs/pcs-xpcs.c=33=static const int xpcs_10gkr_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-36-\tETHTOOL_LINK_MODE_10000baseKR_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:37:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-38-};\n--\ndrivers/net/pcs/pcs-xpcs.c=40=static const int xpcs_25gbaser_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-46-\tETHTOOL_LINK_MODE_25000baseSR_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:47:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-48-};\n--\ndrivers/net/pcs/pcs-xpcs.c=50=static const int xpcs_xlgmii_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-76-\tETHTOOL_LINK_MODE_100000baseDR2_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:77:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-78-};\n--\ndrivers/net/pcs/pcs-xpcs.c=80=static const int xpcs_50gbaser_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-88-\tETHTOOL_LINK_MODE_50000baseDR_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:89:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-90-};\n--\ndrivers/net/pcs/pcs-xpcs.c=92=static const int xpcs_50gbaser2_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-98-\tETHTOOL_LINK_MODE_50000baseSR2_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:99:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-100-};\n--\ndrivers/net/pcs/pcs-xpcs.c=102=static const int xpcs_100gbasep_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-110-\tETHTOOL_LINK_MODE_100000baseDR2_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:111:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-112-};\n--\ndrivers/net/pcs/pcs-xpcs.c=114=static const int xpcs_10gbaser_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-120-\tETHTOOL_LINK_MODE_10000baseER_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:121:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-122-};\n--\ndrivers/net/pcs/pcs-xpcs.c=124=static const int xpcs_sgmii_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-133-\tETHTOOL_LINK_MODE_1000baseT_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:134:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-135-};\n--\ndrivers/net/pcs/pcs-xpcs.c=137=static const int xpcs_1000basex_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-141-\tETHTOOL_LINK_MODE_1000baseX_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:142:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-143-};\n--\ndrivers/net/pcs/pcs-xpcs.c=145=static const int xpcs_2500basex_features[] = {\n--\ndrivers/net/pcs/pcs-xpcs.c-150-\tETHTOOL_LINK_MODE_2500baseT_Full_BIT,\ndrivers/net/pcs/pcs-xpcs.c:151:\t__ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/pcs/pcs-xpcs.c-152-};\n--\ndrivers/net/pcs/pcs-xpcs.c=197=static bool __xpcs_linkmode_supported(const struct dw_xpcs_compat *compat,\n--\ndrivers/net/pcs/pcs-xpcs.c-201-\ndrivers/net/pcs/pcs-xpcs.c:202:\tfor (i = 0; compat-\u003esupported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++)\ndrivers/net/pcs/pcs-xpcs.c-203-\t\tif (compat-\u003esupported[i] == linkmode)\n--\ndrivers/net/pcs/pcs-xpcs.c=516=static int xpcs_get_max_xlgmii_speed(struct dw_xpcs *xpcs,\n--\ndrivers/net/pcs/pcs-xpcs.c-522-\ndrivers/net/pcs/pcs-xpcs.c:523:\tfor_each_set_bit(bit, adv, __ETHTOOL_LINK_MODE_MASK_NBITS) {\ndrivers/net/pcs/pcs-xpcs.c-524-\t\tint new_speed = SPEED_UNKNOWN;\n--\ndrivers/net/pcs/pcs-xpcs.c=645=static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,\n--\ndrivers/net/pcs/pcs-xpcs.c-661-\t */\ndrivers/net/pcs/pcs-xpcs.c:662:\tfor (i = 0; compat-\u003esupported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++)\ndrivers/net/pcs/pcs-xpcs.c-663-\t\tset_bit(compat-\u003esupported[i], xpcs_supported);\n--\ndrivers/net/phy/phy-core.c=19=const char *phy_speed_to_str(int speed)\ndrivers/net/phy/phy-core.c-20-{\ndrivers/net/phy/phy-core.c:21:\tBUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 125,\ndrivers/net/phy/phy-core.c-22-\t\t\"Enum ethtool_link_mode_bit_indices and phylib are out of sync. \"\n--\ndrivers/net/phy/phy_caps.c=77=int __init phy_caps_init(void)\n--\ndrivers/net/phy/phy_caps.c-82-\t/* Fill the caps array from net/ethtool/common.c */\ndrivers/net/phy/phy_caps.c:83:\tfor (i = 0; i \u003c __ETHTOOL_LINK_MODE_MASK_NBITS; i++) {\ndrivers/net/phy/phy_caps.c-84-\t\tlinkmode = \u0026link_mode_params[i];\n--\ndrivers/net/phy/phy_caps.c=402=void phy_caps_medium_get_supported(unsigned long *supported,\n--\ndrivers/net/phy/phy_caps.c-407-\ndrivers/net/phy/phy_caps.c:408:\tfor (i = 0; i \u003c __ETHTOOL_LINK_MODE_MASK_NBITS; i++) {\ndrivers/net/phy/phy_caps.c-409-\t\t/* Special bits such as Autoneg, Pause, Asym_pause, etc. are\n--\ndrivers/net/phy/phy_caps.c=434=u32 phy_caps_mediums_from_linkmodes(unsigned long *linkmodes)\n--\ndrivers/net/phy/phy_caps.c-439-\ndrivers/net/phy/phy_caps.c:440:\tfor_each_set_bit(i, linkmodes, __ETHTOOL_LINK_MODE_MASK_NBITS) {\ndrivers/net/phy/phy_caps.c-441-\t\tlinkmode = \u0026link_mode_params[i];\n--\ndrivers/net/phy/phy_device.c=3452=static int phy_default_setup_single_port(struct phy_device *phydev)\n--\ndrivers/net/phy/phy_device.c-3477-\ndrivers/net/phy/phy_device.c:3478:\tfor_each_set_bit(mode, port-\u003esupported, __ETHTOOL_LINK_MODE_MASK_NBITS)\ndrivers/net/phy/phy_device.c-3479-\t\tport-\u003epairs = max_t(int, port-\u003epairs,\n--\ndrivers/net/phy/phy_port.c=109=void phy_port_update_supported(struct phy_port *port)\n--\ndrivers/net/phy/phy_port.c-119-\t\tfor_each_set_bit(mode, port-\u003esupported,\ndrivers/net/phy/phy_port.c:120:\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS)\ndrivers/net/phy/phy_port.c-121-\t\t\tport-\u003epairs = max_t(int, port-\u003epairs,\n--\ndrivers/net/phy/phylink.c=579=static void phylink_validate_one(struct phylink *pl, struct phy_device *phy,\n--\ndrivers/net/phy/phylink.c-600-\t\t\t phy_rate_matching_to_str(tmp_state.rate_matching),\ndrivers/net/phy/phylink.c:601:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, tmp_supported);\ndrivers/net/phy/phylink.c-602-\n--\ndrivers/net/phy/phylink.c=1000=static void phylink_mac_config(struct phylink *pl,\n--\ndrivers/net/phy/phylink.c-1016-\t\t phy_rate_matching_to_str(st.rate_matching),\ndrivers/net/phy/phylink.c:1017:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, st.advertising,\ndrivers/net/phy/phylink.c-1018-\t\t st.pause);\n--\ndrivers/net/phy/phylink.c=1375=static int phylink_change_inband_advert(struct phylink *pl)\n--\ndrivers/net/phy/phylink.c-1384-\t\t phy_modes(pl-\u003elink_config.interface),\ndrivers/net/phy/phylink.c:1385:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, pl-\u003elink_config.advertising,\ndrivers/net/phy/phylink.c-1386-\t\t pl-\u003elink_config.pause);\n--\ndrivers/net/phy/phylink.c=2086=static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,\n--\ndrivers/net/phy/phylink.c-2111-\t\t\t phy_modes(config.interface),\ndrivers/net/phy/phylink.c:2112:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, phy-\u003esupported,\ndrivers/net/phy/phylink.c:2113:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, config.advertising,\ndrivers/net/phy/phylink.c-2114-\t\t\t ERR_PTR(ret));\n--\ndrivers/net/phy/phylink.c-2177-\t\t phy_modes(interface),\ndrivers/net/phy/phylink.c:2178:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, pl-\u003esupported,\ndrivers/net/phy/phylink.c:2179:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, phy-\u003eadvertising);\ndrivers/net/phy/phylink.c-2180-\n--\ndrivers/net/phy/phylink.c=2814=static phy_interface_t phylink_sfp_select_interface(struct phylink *pl,\n--\ndrivers/net/phy/phylink.c-2822-\t\t\t \"selection of interface failed, advertisement %*pb\\n\",\ndrivers/net/phy/phylink.c:2823:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS,\ndrivers/net/phy/phylink.c-2824-\t\t\t link_modes);\n--\ndrivers/net/phy/phylink.c=2977=int phylink_ethtool_ksettings_set(struct phylink *pl,\n--\ndrivers/net/phy/phylink.c-3091-\t\t\t\t phy_modes(config.interface),\ndrivers/net/phy/phylink.c:3092:\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, support);\ndrivers/net/phy/phylink.c-3093-\t\t\treturn -EINVAL;\n--\ndrivers/net/phy/phylink.c=3323=int phylink_ethtool_set_eee(struct phylink *pl, struct ethtool_keee *eee)\n--\ndrivers/net/phy/phylink.c-3332-\t\t eee-\u003eeee_enabled ? \", enabled\" : \"\",\ndrivers/net/phy/phylink.c:3333:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, eee-\u003eadvertised,\ndrivers/net/phy/phylink.c-3334-\t\t eee-\u003etx_lpi_enabled ? \" enabled\" : \"\", eee-\u003etx_lpi_timer);\n--\ndrivers/net/phy/phylink.c=3663=static void phylink_sfp_set_config(struct phylink *pl, unsigned long *supported,\n--\ndrivers/net/phy/phylink.c-3670-\t\t phylink_an_mode_str(mode), phy_modes(state-\u003einterface),\ndrivers/net/phy/phylink.c:3671:\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, supported);\ndrivers/net/phy/phylink.c-3672-\n--\ndrivers/net/phy/phylink.c=3700=static int phylink_sfp_config_phy(struct phylink *pl, struct phy_device *phy)\n--\ndrivers/net/phy/phylink.c-3720-\t\tphylink_err(pl, \"validation with support %*pb failed: %pe\\n\",\ndrivers/net/phy/phylink.c:3721:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, support,\ndrivers/net/phy/phylink.c-3722-\t\t\t ERR_PTR(ret));\n--\ndrivers/net/phy/phylink.c=3751=static int phylink_sfp_config_optical(struct phylink *pl)\n--\ndrivers/net/phy/phylink.c-3788-\t\tphylink_err(pl, \"unsupported SFP module: validation with support %*pb failed\\n\",\ndrivers/net/phy/phylink.c:3789:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, support);\ndrivers/net/phy/phylink.c-3790-\t\treturn ret;\n--\ndrivers/net/phy/phylink.c-3830-\t\tphylink_err(pl, \"validation with support %*pb failed: %pe\\n\",\ndrivers/net/phy/phylink.c:3831:\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS, support,\ndrivers/net/phy/phylink.c-3832-\t\t\t ERR_PTR(ret));\n--\ninclude/linux/ethtool.h=261=static inline int ethtool_linkmode_n_pairs(unsigned int mode)\n--\ninclude/linux/ethtool.h-267-#define __ETHTOOL_DECLARE_LINK_MODE_MASK(name)\t\t\\\ninclude/linux/ethtool.h:268:\tDECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS)\ninclude/linux/ethtool.h-269-\n--\ninclude/linux/ethtool.h=273=struct ethtool_link_ksettings {\n--\ninclude/linux/ethtool.h-288-#define ethtool_link_ksettings_zero_link_mode(ptr, name)\t\t\\\ninclude/linux/ethtool.h:289:\tbitmap_zero((ptr)-\u003elink_modes.name, __ETHTOOL_LINK_MODE_MASK_NBITS)\ninclude/linux/ethtool.h-290-\n--\ninclude/linux/ethtool.h=923=struct kernel_ethtool_ts_info {\n--\ninclude/linux/ethtool.h-1142- *\tsettings. The %cmd and %link_mode_masks_nwords fields should be\ninclude/linux/ethtool.h:1143: *\tignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS instead of the latter),\ninclude/linux/ethtool.h-1144- *\tany change to them will be overwritten by kernel. Returns a negative\n--\ninclude/linux/ethtool.h-1147- *\tsettings. The %cmd and %link_mode_masks_nwords fields should be\ninclude/linux/ethtool.h:1148: *\tignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS instead of the latter),\ninclude/linux/ethtool.h-1149- *\tany change to them will be overwritten by kernel. Returns a negative\n--\ninclude/linux/linkmode.h=8=static inline void linkmode_zero(unsigned long *dst)\ninclude/linux/linkmode.h-9-{\ninclude/linux/linkmode.h:10:\tbitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-11-}\n--\ninclude/linux/linkmode.h=13=static inline void linkmode_fill(unsigned long *dst)\ninclude/linux/linkmode.h-14-{\ninclude/linux/linkmode.h:15:\tbitmap_fill(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-16-}\n--\ninclude/linux/linkmode.h=18=static inline void linkmode_copy(unsigned long *dst, const unsigned long *src)\ninclude/linux/linkmode.h-19-{\ninclude/linux/linkmode.h:20:\tbitmap_copy(dst, src, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-21-}\n--\ninclude/linux/linkmode.h=23=static inline bool linkmode_and(unsigned long *dst, const unsigned long *a,\n--\ninclude/linux/linkmode.h-25-{\ninclude/linux/linkmode.h:26:\treturn bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-27-}\n--\ninclude/linux/linkmode.h=29=static inline bool linkmode_and_and(unsigned long *dst,\n--\ninclude/linux/linkmode.h-33-{\ninclude/linux/linkmode.h:34:\treturn bitmap_and_and(dst, a, b, c, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-35-}\n--\ninclude/linux/linkmode.h=37=static inline bool linkmode_and_andnot(unsigned long *dst,\n--\ninclude/linux/linkmode.h-42-\treturn bitmap_and_andnot(dst, a, b, c,\ninclude/linux/linkmode.h:43:\t\t\t\t __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-44-}\n--\ninclude/linux/linkmode.h=46=static inline void linkmode_or(unsigned long *dst, const unsigned long *a,\n--\ninclude/linux/linkmode.h-48-{\ninclude/linux/linkmode.h:49:\tbitmap_or(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-50-}\n--\ninclude/linux/linkmode.h=52=static inline bool linkmode_empty(const unsigned long *src)\ninclude/linux/linkmode.h-53-{\ninclude/linux/linkmode.h:54:\treturn bitmap_empty(src, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-55-}\n--\ninclude/linux/linkmode.h=57=static inline bool linkmode_andnot(unsigned long *dst,\n--\ninclude/linux/linkmode.h-60-{\ninclude/linux/linkmode.h:61:\treturn bitmap_andnot(dst, src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-62-}\n--\ninclude/linux/linkmode.h=78=static inline int linkmode_equal(const unsigned long *src1,\n--\ninclude/linux/linkmode.h-80-{\ninclude/linux/linkmode.h:81:\treturn bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-82-}\n--\ninclude/linux/linkmode.h=84=static inline int linkmode_intersects(const unsigned long *src1,\n--\ninclude/linux/linkmode.h-86-{\ninclude/linux/linkmode.h:87:\treturn bitmap_intersects(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-88-}\n--\ninclude/linux/linkmode.h=90=static inline int linkmode_subset(const unsigned long *src1,\n--\ninclude/linux/linkmode.h-92-{\ninclude/linux/linkmode.h:93:\treturn bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);\ninclude/linux/linkmode.h-94-}\n--\ninclude/linux/phylink.h=770=int phylink_speed_up(struct phylink *pl);\n--\ninclude/linux/phylink.h-772-#define phylink_zero(bm) \\\ninclude/linux/phylink.h:773:\tbitmap_zero(bm, __ETHTOOL_LINK_MODE_MASK_NBITS)\ninclude/linux/phylink.h-774-#define __phylink_do_bit(op, bm, mode) \\\n--\ninclude/uapi/linux/ethtool.h=1966=enum ethtool_link_mode_bit_indices {\n--\ninclude/uapi/linux/ethtool.h-2107-\t/* must be last entry */\ninclude/uapi/linux/ethtool.h:2108:\t__ETHTOOL_LINK_MODE_MASK_NBITS\ninclude/uapi/linux/ethtool.h-2109-};\n--\ninclude/uapi/linux/ethtool.h=2443=enum ethtool_reset_flags {\n--\ninclude/uapi/linux/ethtool.h-2512- *\trefused. For drivers: ignore this field (use kernel's\ninclude/uapi/linux/ethtool.h:2513: *\t__ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will\ninclude/uapi/linux/ethtool.h-2514- *\tbe overwritten by kernel.\n--\ninclude/uapi/linux/ethtool.h-2550- * by kernel), and rely only on kernel's internal\ninclude/uapi/linux/ethtool.h:2551: * %__ETHTOOL_LINK_MODE_MASK_NBITS and\ninclude/uapi/linux/ethtool.h-2552- * %ethtool_link_mode_mask_t. Drivers that implement\n--\nnet/ethtool/common.c=116=const char link_mode_names[][ETH_GSTRING_LEN] = {\n--\nnet/ethtool/common.c-242-};\nnet/ethtool/common.c:243:static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);\nnet/ethtool/common.c-244-\n--\nnet/ethtool/common.c=329=const struct link_mode_info link_mode_params[] = {\n--\nnet/ethtool/common.c-469-};\nnet/ethtool/common.c:470:static_assert(ARRAY_SIZE(link_mode_params) == __ETHTOOL_LINK_MODE_MASK_NBITS);\nnet/ethtool/common.c-471-EXPORT_SYMBOL_GPL(link_mode_params);\n--\nnet/ethtool/common.c=1158=ethtool_params_from_link_mode(struct ethtool_link_ksettings *link_ksettings,\n--\nnet/ethtool/common.c-1162-\nnet/ethtool/common.c:1163:\tif (WARN_ON_ONCE(link_mode \u003e= __ETHTOOL_LINK_MODE_MASK_NBITS))\nnet/ethtool/common.c-1164-\t\treturn;\n--\nnet/ethtool/eee.c=44=static int eee_reply_size(const struct ethnl_req_info *req_base,\n--\nnet/ethtool/eee.c-54-\tret = ethnl_bitset_size(eee-\u003eadvertised, eee-\u003esupported,\nnet/ethtool/eee.c:55:\t\t\t\t__ETHTOOL_LINK_MODE_MASK_NBITS,\nnet/ethtool/eee.c-56-\t\t\t\tlink_mode_names, compact);\n--\nnet/ethtool/eee.c-61-\tret = ethnl_bitset_size(eee-\u003elp_advertised, NULL,\nnet/ethtool/eee.c:62:\t\t\t\t__ETHTOOL_LINK_MODE_MASK_NBITS,\nnet/ethtool/eee.c-63-\t\t\t\tlink_mode_names, compact);\n--\nnet/ethtool/eee.c=76=static int eee_fill_reply(struct sk_buff *skb,\n\n"
} |
| 5/2 | 2026/09/08 02:06 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 23789 output: 20 thoughts: 111 Thoughts: **Analyzing the ETHTOOL Link Mode Mask** Okay, so I'm looking at this `__ETHTOOL_LINK_MODE_MASK_NBITS` definition, and it's flagged as 125, which is... interesting. That's significantly more than 64, well past what we'd expect for `BITS_PER_LONG` on a 64-bit architecture. This throws a bit of a wrench into my typical assumptions about how the kernel handles these bit masks. I need to be sure the relevant functions will behave as expected. Specifically, I'm concerned about the `small_const_nbits(nbits)` function. With `__ETHTOOL_LINK_MODE_MASK_NBITS` being greater than 64, it *should* evaluate to false, meaning the more performant optimized functions might not be selected. I need to understand why this definition exists. Let's quickly check the implementation of `small_const_nbits` in `include/linux/bitmap.h` to confirm my understanding and to see what potential implications this might have for the bitmask operations. I want to see how these larger bitmasks are handled, and if there are any performance considerations I should be aware of. I'm keen to evaluate this from an expert's perspective! |
| 6/2 | 2026/09/08 02:06 | tool | grepper |
0mArgs:{
"Expression": "small_const_nbits"
}Results: {
"Output": "include/asm-generic/bitsperlong.h=27=_Static_assert(sizeof(long) * 8 == __BITS_PER_LONG,\n--\ninclude/asm-generic/bitsperlong.h-35-/*\ninclude/asm-generic/bitsperlong.h:36: * small_const_nbits(n) is true precisely when it is known at compile-time\ninclude/asm-generic/bitsperlong.h-37- * that BITMAP_SIZE(n) is 1, i.e. 1 \u003c= n \u003c= BITS_PER_LONG. This allows\n--\ninclude/asm-generic/bitsperlong.h-43- */\ninclude/asm-generic/bitsperlong.h:44:#define small_const_nbits(nbits) \\\ninclude/asm-generic/bitsperlong.h-45-\t(__builtin_constant_p(nbits) \u0026\u0026 (nbits) \u003c= BITS_PER_LONG \u0026\u0026 (nbits) \u003e 0)\n--\ninclude/linux/bitmap.h=251=static __always_inline void bitmap_zero(unsigned long *dst, unsigned int nbits)\n--\ninclude/linux/bitmap.h-254-\ninclude/linux/bitmap.h:255:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-256-\t\t*dst = 0;\n--\ninclude/linux/bitmap.h=261=static __always_inline void bitmap_fill(unsigned long *dst, unsigned int nbits)\n--\ninclude/linux/bitmap.h-264-\ninclude/linux/bitmap.h:265:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-266-\t\t*dst = ~0UL;\n--\ninclude/linux/bitmap.h=272=void bitmap_copy(unsigned long *dst, const unsigned long *src, unsigned int nbits)\n--\ninclude/linux/bitmap.h-275-\ninclude/linux/bitmap.h:276:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-277-\t\t*dst = *src;\n--\ninclude/linux/bitmap.h=342=bool bitmap_and(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-344-{\ninclude/linux/bitmap.h:345:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-346-\t\treturn (*dst = *src1 \u0026 *src2 \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ninclude/linux/bitmap.h=351=bool bitmap_and_and(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-354-{\ninclude/linux/bitmap.h:355:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-356-\t\treturn (*dst = *src1 \u0026 *src2 \u0026 *src3 \u0026\n--\ninclude/linux/bitmap.h=362=bool bitmap_and_andnot(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-365-{\ninclude/linux/bitmap.h:366:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-367-\t\treturn (*dst = *src1 \u0026 *src2 \u0026 ~(*src3) \u0026\n--\ninclude/linux/bitmap.h=373=void bitmap_or(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-375-{\ninclude/linux/bitmap.h:376:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-377-\t\t*dst = *src1 | *src2;\n--\ninclude/linux/bitmap.h=383=unsigned int bitmap_weighted_or(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-385-{\ninclude/linux/bitmap.h:386:\tif (small_const_nbits(nbits)) {\ninclude/linux/bitmap.h-387-\t\t*dst = *src1 | *src2;\n--\ninclude/linux/bitmap.h=395=unsigned int bitmap_weighted_xor(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-397-{\ninclude/linux/bitmap.h:398:\tif (small_const_nbits(nbits)) {\ninclude/linux/bitmap.h-399-\t\t*dst = *src1 ^ *src2;\n--\ninclude/linux/bitmap.h=407=void bitmap_xor(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-409-{\ninclude/linux/bitmap.h:410:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-411-\t\t*dst = *src1 ^ *src2;\n--\ninclude/linux/bitmap.h=417=bool bitmap_andnot(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-419-{\ninclude/linux/bitmap.h:420:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-421-\t\treturn (*dst = *src1 \u0026 ~(*src2) \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ninclude/linux/bitmap.h=426=void bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned int nbits)\ninclude/linux/bitmap.h-427-{\ninclude/linux/bitmap.h:428:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-429-\t\t*dst = ~(*src);\n--\ninclude/linux/bitmap.h=442=bool bitmap_equal(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)\ninclude/linux/bitmap.h-443-{\ninclude/linux/bitmap.h:444:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-445-\t\treturn !((*src1 ^ *src2) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=462=bool bitmap_or_equal(const unsigned long *src1, const unsigned long *src2,\n--\ninclude/linux/bitmap.h-464-{\ninclude/linux/bitmap.h:465:\tif (!small_const_nbits(nbits))\ninclude/linux/bitmap.h-466-\t\treturn __bitmap_or_equal(src1, src2, src3, nbits);\n--\ninclude/linux/bitmap.h=472=bool bitmap_intersects(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)\ninclude/linux/bitmap.h-473-{\ninclude/linux/bitmap.h:474:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-475-\t\treturn ((*src1 \u0026 *src2) \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ninclude/linux/bitmap.h=481=bool bitmap_subset(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)\ninclude/linux/bitmap.h-482-{\ninclude/linux/bitmap.h:483:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-484-\t\treturn ! ((*src1 \u0026 ~(*src2)) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=490=bool bitmap_empty(const unsigned long *src, unsigned nbits)\ninclude/linux/bitmap.h-491-{\ninclude/linux/bitmap.h:492:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-493-\t\treturn ! (*src \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=499=bool bitmap_full(const unsigned long *src, unsigned int nbits)\ninclude/linux/bitmap.h-500-{\ninclude/linux/bitmap.h:501:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-502-\t\treturn ! (~(*src) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=508=unsigned int bitmap_weight(const unsigned long *src, unsigned int nbits)\ninclude/linux/bitmap.h-509-{\ninclude/linux/bitmap.h:510:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-511-\t\treturn hweight_long(*src \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=516=unsigned long bitmap_weight_and(const unsigned long *src1,\n--\ninclude/linux/bitmap.h-518-{\ninclude/linux/bitmap.h:519:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-520-\t\treturn hweight_long(*src1 \u0026 *src2 \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=525=unsigned long bitmap_weight_andnot(const unsigned long *src1,\n--\ninclude/linux/bitmap.h-527-{\ninclude/linux/bitmap.h:528:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-529-\t\treturn hweight_long(*src1 \u0026 ~(*src2) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=543=unsigned long bitmap_weight_from(const unsigned long *bitmap,\n--\ninclude/linux/bitmap.h-550-\ninclude/linux/bitmap.h:551:\tif (small_const_nbits(end))\ninclude/linux/bitmap.h-552-\t\treturn hweight_long(*bitmap \u0026 GENMASK(end - 1, start));\n--\ninclude/linux/bitmap.h=566=void bitmap_set(unsigned long *map, unsigned int start, unsigned int nbits)\n--\ninclude/linux/bitmap.h-569-\t\t__set_bit(start, map);\ninclude/linux/bitmap.h:570:\telse if (small_const_nbits(start + nbits))\ninclude/linux/bitmap.h-571-\t\t*map |= GENMASK(start + nbits - 1, start);\n--\ninclude/linux/bitmap.h=582=void bitmap_clear(unsigned long *map, unsigned int start, unsigned int nbits)\n--\ninclude/linux/bitmap.h-585-\t\t__clear_bit(start, map);\ninclude/linux/bitmap.h:586:\telse if (small_const_nbits(start + nbits))\ninclude/linux/bitmap.h-587-\t\t*map \u0026= ~GENMASK(start + nbits - 1, start);\n--\ninclude/linux/bitmap.h=598=void bitmap_shift_right(unsigned long *dst, const unsigned long *src,\n--\ninclude/linux/bitmap.h-600-{\ninclude/linux/bitmap.h:601:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-602-\t\t*dst = (*src \u0026 BITMAP_LAST_WORD_MASK(nbits)) \u003e\u003e shift;\n--\ninclude/linux/bitmap.h=608=void bitmap_shift_left(unsigned long *dst, const unsigned long *src,\n--\ninclude/linux/bitmap.h-610-{\ninclude/linux/bitmap.h:611:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-612-\t\t*dst = (*src \u003c\u003c shift) \u0026 BITMAP_LAST_WORD_MASK(nbits);\n--\ninclude/linux/bitmap.h=618=void bitmap_replace(unsigned long *dst,\n--\ninclude/linux/bitmap.h-623-{\ninclude/linux/bitmap.h:624:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-625-\t\t*dst = (*old \u0026 ~(*mask)) | (*new \u0026 *mask);\n--\ninclude/linux/cpumask.h=687=static __always_inline void cpumask_setall(struct cpumask *dstp)\ninclude/linux/cpumask.h-688-{\ninclude/linux/cpumask.h:689:\tif (small_const_nbits(small_cpumask_bits)) {\ninclude/linux/cpumask.h-690-\t\tcpumask_bits(dstp)[0] = BITMAP_LAST_WORD_MASK(nr_cpumask_bits);\n--\ninclude/linux/find.h=58=unsigned long find_next_bit(const unsigned long *addr, unsigned long size,\n--\ninclude/linux/find.h-60-{\ninclude/linux/find.h:61:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-62-\t\tunsigned long val;\n--\ninclude/linux/find.h=87=unsigned long find_next_and_bit(const unsigned long *addr1,\n--\ninclude/linux/find.h-90-{\ninclude/linux/find.h:91:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-92-\t\tunsigned long val;\n--\ninclude/linux/find.h=118=unsigned long find_next_andnot_bit(const unsigned long *addr1,\n--\ninclude/linux/find.h-121-{\ninclude/linux/find.h:122:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-123-\t\tunsigned long val;\n--\ninclude/linux/find.h=148=unsigned long find_next_or_bit(const unsigned long *addr1,\n--\ninclude/linux/find.h-151-{\ninclude/linux/find.h:152:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-153-\t\tunsigned long val;\n--\ninclude/linux/find.h=177=unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,\n--\ninclude/linux/find.h-179-{\ninclude/linux/find.h:180:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-181-\t\tunsigned long val;\n--\ninclude/linux/find.h=204=unsigned long find_first_bit(const unsigned long *addr, unsigned long size)\ninclude/linux/find.h-205-{\ninclude/linux/find.h:206:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-207-\t\tunsigned long val = *addr \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=230=unsigned long find_nth_bit(const unsigned long *addr, unsigned long size, unsigned long n)\n--\ninclude/linux/find.h-234-\ninclude/linux/find.h:235:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-236-\t\tunsigned long val = *addr \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=255=unsigned long find_nth_and_bit(const unsigned long *addr1, const unsigned long *addr2,\n--\ninclude/linux/find.h-260-\ninclude/linux/find.h:261:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-262-\t\tunsigned long val = *addr1 \u0026 *addr2 \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=283=unsigned long find_nth_and_andnot_bit(const unsigned long *addr1,\n--\ninclude/linux/find.h-290-\ninclude/linux/find.h:291:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-292-\t\tunsigned long val = *addr1 \u0026 *addr2 \u0026 (~*addr3) \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=311=unsigned long find_first_and_bit(const unsigned long *addr1,\n--\ninclude/linux/find.h-314-{\ninclude/linux/find.h:315:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-316-\t\tunsigned long val = *addr1 \u0026 *addr2 \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=335=unsigned long find_first_andnot_bit(const unsigned long *addr1,\n--\ninclude/linux/find.h-338-{\ninclude/linux/find.h:339:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-340-\t\tunsigned long val = *addr1 \u0026 (~*addr2) \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=359=unsigned long find_first_and_and_bit(const unsigned long *addr1,\n--\ninclude/linux/find.h-363-{\ninclude/linux/find.h:364:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-365-\t\tunsigned long val = *addr1 \u0026 *addr2 \u0026 *addr3 \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=383=unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)\ninclude/linux/find.h-384-{\ninclude/linux/find.h:385:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-386-\t\tunsigned long val = *addr | ~GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=404=unsigned long find_last_bit(const unsigned long *addr, unsigned long size)\ninclude/linux/find.h-405-{\ninclude/linux/find.h:406:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-407-\t\tunsigned long val = *addr \u0026 GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=529=unsigned long find_next_zero_bit_le(const void *addr, unsigned\n--\ninclude/linux/find.h-531-{\ninclude/linux/find.h:532:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-533-\t\tunsigned long val = *(const unsigned long *)addr;\n--\ninclude/linux/find.h=548=unsigned long find_first_zero_bit_le(const void *addr, unsigned long size)\ninclude/linux/find.h-549-{\ninclude/linux/find.h:550:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-551-\t\tunsigned long val = swab(*(const unsigned long *)addr) | ~GENMASK(size - 1, 0);\n--\ninclude/linux/find.h=562=unsigned long find_next_bit_le(const void *addr, unsigned\n--\ninclude/linux/find.h-564-{\ninclude/linux/find.h:565:\tif (small_const_nbits(size)) {\ninclude/linux/find.h-566-\t\tunsigned long val = *(const unsigned long *)addr;\n--\ntools/include/asm-generic/bitsperlong.h-20-\ntools/include/asm-generic/bitsperlong.h:21:#define small_const_nbits(nbits) \\\ntools/include/asm-generic/bitsperlong.h-22-\t(__builtin_constant_p(nbits) \u0026\u0026 (nbits) \u003c= BITS_PER_LONG \u0026\u0026 (nbits) \u003e 0)\n--\ntools/include/linux/bitmap.h=39=static inline void bitmap_zero(unsigned long *dst, unsigned int nbits)\ntools/include/linux/bitmap.h-40-{\ntools/include/linux/bitmap.h:41:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-42-\t\t*dst = 0UL;\n--\ntools/include/linux/bitmap.h=48=static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)\n--\ntools/include/linux/bitmap.h-50-\tunsigned int nlongs = BITS_TO_LONGS(nbits);\ntools/include/linux/bitmap.h:51:\tif (!small_const_nbits(nbits)) {\ntools/include/linux/bitmap.h-52-\t\tunsigned int len = (nlongs - 1) * sizeof(unsigned long);\n--\ntools/include/linux/bitmap.h=59=void bitmap_copy(unsigned long *dst, const unsigned long *src, unsigned int nbits)\n--\ntools/include/linux/bitmap.h-62-\ntools/include/linux/bitmap.h:63:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-64-\t\t*dst = *src;\n--\ntools/include/linux/bitmap.h=69=static inline bool bitmap_empty(const unsigned long *src, unsigned int nbits)\ntools/include/linux/bitmap.h-70-{\ntools/include/linux/bitmap.h:71:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-72-\t\treturn ! (*src \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ntools/include/linux/bitmap.h=77=static inline bool bitmap_full(const unsigned long *src, unsigned int nbits)\ntools/include/linux/bitmap.h-78-{\ntools/include/linux/bitmap.h:79:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-80-\t\treturn ! (~(*src) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ntools/include/linux/bitmap.h=85=static inline unsigned int bitmap_weight(const unsigned long *src, unsigned int nbits)\ntools/include/linux/bitmap.h-86-{\ntools/include/linux/bitmap.h:87:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-88-\t\treturn hweight_long(*src \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ntools/include/linux/bitmap.h=92=static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,\n--\ntools/include/linux/bitmap.h-94-{\ntools/include/linux/bitmap.h:95:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-96-\t\t*dst = *src1 | *src2;\n--\ntools/include/linux/bitmap.h=102=bool bitmap_andnot(unsigned long *dst, const unsigned long *src1,\n--\ntools/include/linux/bitmap.h-104-{\ntools/include/linux/bitmap.h:105:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-106-\t\treturn (*dst = *src1 \u0026 ~(*src2) \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ntools/include/linux/bitmap.h=150=static inline bool bitmap_and(unsigned long *dst, const unsigned long *src1,\n--\ntools/include/linux/bitmap.h-152-{\ntools/include/linux/bitmap.h:153:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-154-\t\treturn (*dst = *src1 \u0026 *src2 \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ntools/include/linux/bitmap.h=165=static inline bool bitmap_equal(const unsigned long *src1,\n--\ntools/include/linux/bitmap.h-167-{\ntools/include/linux/bitmap.h:168:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-169-\t\treturn !((*src1 ^ *src2) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ntools/include/linux/bitmap.h=176=static inline bool bitmap_intersects(const unsigned long *src1,\n--\ntools/include/linux/bitmap.h-179-{\ntools/include/linux/bitmap.h:180:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-181-\t\treturn ((*src1 \u0026 *src2) \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ntools/include/linux/bitmap.h=187=bool bitmap_subset(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)\ntools/include/linux/bitmap.h-188-{\ntools/include/linux/bitmap.h:189:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-190-\t\treturn ! ((*src1 \u0026 ~(*src2)) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ntools/include/linux/bitmap.h=195=static inline void bitmap_set(unsigned long *map, unsigned int start, unsigned int nbits)\n--\ntools/include/linux/bitmap.h-198-\t\t__set_bit(start, map);\ntools/include/linux/bitmap.h:199:\telse if (small_const_nbits(start + nbits))\ntools/include/linux/bitmap.h-200-\t\t*map |= GENMASK(start + nbits - 1, start);\n--\ntools/include/linux/bitmap.h=210=static inline void bitmap_clear(unsigned long *map, unsigned int start,\n--\ntools/include/linux/bitmap.h-214-\t\t__clear_bit(start, map);\ntools/include/linux/bitmap.h:215:\telse if (small_const_nbits(start + nbits))\ntools/include/linux/bitmap.h-216-\t\t*map \u0026= ~GENMASK(start + nbits - 1, start);\n--\ntools/include/linux/bitmap.h=227=void bitmap_xor(unsigned long *dst, const unsigned long *src1,\n--\ntools/include/linux/bitmap.h-229-{\ntools/include/linux/bitmap.h:230:\tif (small_const_nbits(nbits))\ntools/include/linux/bitmap.h-231-\t\t*dst = *src1 ^ *src2;\n--\ntools/include/linux/find.h=33=unsigned long find_next_bit(const unsigned long *addr, unsigned long size,\n--\ntools/include/linux/find.h-35-{\ntools/include/linux/find.h:36:\tif (small_const_nbits(size)) {\ntools/include/linux/find.h-37-\t\tunsigned long val;\n--\ntools/include/linux/find.h=62=unsigned long find_next_and_bit(const unsigned long *addr1,\n--\ntools/include/linux/find.h-65-{\ntools/include/linux/find.h:66:\tif (small_const_nbits(size)) {\ntools/include/linux/find.h-67-\t\tunsigned long val;\n--\ntools/include/linux/find.h=91=unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,\n--\ntools/include/linux/find.h-93-{\ntools/include/linux/find.h:94:\tif (small_const_nbits(size)) {\ntools/include/linux/find.h-95-\t\tunsigned long val;\n--\ntools/include/linux/find.h=118=unsigned long find_first_bit(const unsigned long *addr, unsigned long size)\ntools/include/linux/find.h-119-{\ntools/include/linux/find.h:120:\tif (small_const_nbits(size)) {\ntools/include/linux/find.h-121-\t\tunsigned long val = *addr \u0026 GENMASK(size - 1, 0);\n--\ntools/include/linux/find.h=141=unsigned long find_first_and_bit(const unsigned long *addr1,\n--\ntools/include/linux/find.h-144-{\ntools/include/linux/find.h:145:\tif (small_const_nbits(size)) {\ntools/include/linux/find.h-146-\t\tunsigned long val = *addr1 \u0026 *addr2 \u0026 GENMASK(size - 1, 0);\n--\ntools/include/linux/find.h=165=unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)\ntools/include/linux/find.h-166-{\ntools/include/linux/find.h:167:\tif (small_const_nbits(size)) {\ntools/include/linux/find.h-168-\t\tunsigned long val = *addr | ~GENMASK(size - 1, 0);\n"
} |
| 7/2 | 2026/09/08 02:06 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 31674 output: 24 thoughts: 504 Thoughts: **Analyzing Bitmap Operations in the Kernel**
Okay, let's break this down. I see that `__bitmap_and`, `__bitmap_and_and`, and `__bitmap_and_andnot` are all defined in `lib/bitmap.c`. Looking at the code, `__bitmap_and` was refactored:
```c
bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int bits)
{
return BITMAP_OP(bitmap1[idx] & bitmap2[idx], bits);
}
```
...using the `BITMAP_OP` macro. Seems pretty straightforward, performing a bitwise AND operation. The macro cleverly handles potential word-length misalignment and updates the destination bitmap. The other two functions, `__bitmap_and_and` and `__bitmap_and_andnot`, were then introduced, presumably leveraging this macro. And, of course, the corresponding public interfaces `bitmap_and_and` and `bitmap_and_andnot` are in `include/linux/bitmap.h`.
Interestingly, I also see similar functions, `linkmode_and`, `linkmode_and_and`, and `linkmode_and_andnot` in `include/linux/linkmode.h`. The `linkmode_and` function appears to be modified to return a bool value.
Now, the important part. I need to understand how these functions are *used*. I'll need to look at what calls them in the reachable kernel code. Specifically, I'll search for calls to `__bitmap_and`, `bitmap_and`, `linkmode_and`, `linkmode_and_and`, and the other related functions. I know that `bitmap_and` is used extensively throughout the kernel. I can see that it's present within cpumasks, nodemasks, drivers, netlink, and even ethtool. I need to grep and check for usages of the kernel's bitwise functions. The `linkmode` calls and `phy_ethtool_ksettings_set` are also worth investigation.
|
| 8/2 | 2026/09/08 02:06 | tool | grepper |
0mArgs:{
"Expression": "phy_ethtool_ksettings_set"
}Results: {
"Output": "Documentation/networking/phy.rst=424=settings in the PHY.\n--\nDocumentation/networking/phy.rst-426-\nDocumentation/networking/phy.rst:427: int phy_ethtool_ksettings_set(struct phy_device *phydev,\nDocumentation/networking/phy.rst-428- const struct ethtool_link_ksettings *cmd);\n--\ndrivers/net/ethernet/apm/xgene-v2/ethtool.c=151=static int xge_set_link_ksettings(struct net_device *ndev,\n--\ndrivers/net/ethernet/apm/xgene-v2/ethtool.c-158-\ndrivers/net/ethernet/apm/xgene-v2/ethtool.c:159:\treturn phy_ethtool_ksettings_set(phydev, cmd);\ndrivers/net/ethernet/apm/xgene-v2/ethtool.c-160-}\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c=164=static int xgene_set_link_ksettings(struct net_device *ndev,\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c-173-\ndrivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:174:\t\treturn phy_ethtool_ksettings_set(phydev, cmd);\ndrivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c-175-\t}\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c-181-\ndrivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:182:\t\t\treturn phy_ethtool_ksettings_set(phydev, cmd);\ndrivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c-183-\t\t}\n--\ndrivers/net/ethernet/broadcom/b44.c=1862=static int b44_set_link_ksettings(struct net_device *dev,\n--\ndrivers/net/ethernet/broadcom/b44.c-1875-\ndrivers/net/ethernet/broadcom/b44.c:1876:\t\tret = phy_ethtool_ksettings_set(dev-\u003ephydev, cmd);\ndrivers/net/ethernet/broadcom/b44.c-1877-\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c=1470=static int bcm_enet_set_link_ksettings(struct net_device *dev,\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-1478-\t\t\treturn -ENODEV;\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c:1479:\t\treturn phy_ethtool_ksettings_set(dev-\u003ephydev, cmd);\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-1480-\t} else {\n--\ndrivers/net/ethernet/broadcom/genet/bcmgenet.c=786=static int bcmgenet_set_link_ksettings(struct net_device *dev,\n--\ndrivers/net/ethernet/broadcom/genet/bcmgenet.c-794-\ndrivers/net/ethernet/broadcom/genet/bcmgenet.c:795:\treturn phy_ethtool_ksettings_set(dev-\u003ephydev, cmd);\ndrivers/net/ethernet/broadcom/genet/bcmgenet.c-796-}\n--\ndrivers/net/ethernet/broadcom/tg3.c=12325=static int tg3_set_link_ksettings(struct net_device *dev,\n--\ndrivers/net/ethernet/broadcom/tg3.c-12336-\t\tphydev = mdiobus_get_phy(tp-\u003emdio_bus, tp-\u003ephy_addr);\ndrivers/net/ethernet/broadcom/tg3.c:12337:\t\treturn phy_ethtool_ksettings_set(phydev, cmd);\ndrivers/net/ethernet/broadcom/tg3.c-12338-\t}\n--\ndrivers/net/ethernet/cortina/gemini.c=2138=static int gmac_set_ksettings(struct net_device *netdev,\n--\ndrivers/net/ethernet/cortina/gemini.c-2142-\t\treturn -ENXIO;\ndrivers/net/ethernet/cortina/gemini.c:2143:\treturn phy_ethtool_ksettings_set(netdev-\u003ephydev, cmd);\ndrivers/net/ethernet/cortina/gemini.c-2144-}\n--\ndrivers/net/ethernet/hisilicon/hns/hns_ethtool.c=200=static int hns_nic_set_link_ksettings(struct net_device *net_dev,\n--\ndrivers/net/ethernet/hisilicon/hns/hns_ethtool.c-228-\t\tif (net_dev-\u003ephydev)\ndrivers/net/ethernet/hisilicon/hns/hns_ethtool.c:229:\t\t\treturn phy_ethtool_ksettings_set(net_dev-\u003ephydev, cmd);\ndrivers/net/ethernet/hisilicon/hns/hns_ethtool.c-230-\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c=3333=hclge_set_phy_link_ksettings(struct hnae3_handle *handle,\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c-3345-\t\t\treturn -EINVAL;\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:3346:\t\tret = phy_ethtool_ksettings_set(handle-\u003enetdev-\u003ephydev, cmd);\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c-3347-\t}\n--\ndrivers/net/ethernet/marvell/mv643xx_eth.c=1580=mv643xx_eth_set_link_ksettings(struct net_device *dev,\n--\ndrivers/net/ethernet/marvell/mv643xx_eth.c-1598-\ndrivers/net/ethernet/marvell/mv643xx_eth.c:1599:\tret = phy_ethtool_ksettings_set(dev-\u003ephydev, \u0026c);\ndrivers/net/ethernet/marvell/mv643xx_eth.c-1600-\tif (!ret)\n--\ndrivers/net/ethernet/realtek/r8169_main.c=2389=static int rtl8169_set_link_ksettings(struct net_device *ndev,\n--\ndrivers/net/ethernet/realtek/r8169_main.c-2397-\tif (!tp-\u003esfp_mode)\ndrivers/net/ethernet/realtek/r8169_main.c:2398:\t\treturn phy_ethtool_ksettings_set(phydev, cmd);\ndrivers/net/ethernet/realtek/r8169_main.c-2399-\n--\ndrivers/net/ethernet/ti/cpsw_ethtool.c=425=int cpsw_set_link_ksettings(struct net_device *ndev,\n--\ndrivers/net/ethernet/ti/cpsw_ethtool.c-434-\ndrivers/net/ethernet/ti/cpsw_ethtool.c:435:\treturn phy_ethtool_ksettings_set(cpsw-\u003eslaves[slave_no].phy, ecmd);\ndrivers/net/ethernet/ti/cpsw_ethtool.c-436-}\n--\ndrivers/net/ethernet/ti/netcp_ethss.c=1953=static int keystone_set_link_ksettings(struct net_device *ndev,\n--\ndrivers/net/ethernet/ti/netcp_ethss.c-1996-\tgbe_intf-\u003eslave-\u003ephy_port_t = port;\ndrivers/net/ethernet/ti/netcp_ethss.c:1997:\treturn phy_ethtool_ksettings_set(phy, cmd);\ndrivers/net/ethernet/ti/netcp_ethss.c-1998-}\n--\ndrivers/net/phy/bcm-phy-lib.c=1168=EXPORT_SYMBOL_GPL(bcm_config_lre_aneg);\n--\ndrivers/net/phy/bcm-phy-lib.c-1178- * sanitized before, to make sure we only advertise what is supported.\ndrivers/net/phy/bcm-phy-lib.c:1179: * The sanitization is done already in phy_ethtool_ksettings_set()\ndrivers/net/phy/bcm-phy-lib.c-1180- */\n--\ndrivers/net/phy/phy.c=1143=static int phy_poll_aneg_done(struct phy_device *phydev)\n--\ndrivers/net/phy/phy.c-1158-\ndrivers/net/phy/phy.c:1159:int phy_ethtool_ksettings_set(struct phy_device *phydev,\ndrivers/net/phy/phy.c-1160-\t\t\t const struct ethtool_link_ksettings *cmd)\n--\ndrivers/net/phy/phy.c-1218-}\ndrivers/net/phy/phy.c:1219:EXPORT_SYMBOL(phy_ethtool_ksettings_set);\ndrivers/net/phy/phy.c-1220-\n--\ndrivers/net/phy/phy.c=2072=int phy_ethtool_set_link_ksettings(struct net_device *ndev,\n--\ndrivers/net/phy/phy.c-2079-\ndrivers/net/phy/phy.c:2080:\treturn phy_ethtool_ksettings_set(phydev, cmd);\ndrivers/net/phy/phy.c-2081-}\n--\ndrivers/net/phy/phylink.c=2977=int phylink_ethtool_ksettings_set(struct phylink *pl,\n--\ndrivers/net/phy/phylink.c-3010-\t\t */\ndrivers/net/phy/phylink.c:3011:\t\treturn phy_ethtool_ksettings_set(pl-\u003ephydev, \u0026phy_kset);\ndrivers/net/phy/phylink.c-3012-\t}\n--\ninclude/linux/phy.h=2384=void phy_ethtool_ksettings_get(struct phy_device *phydev,\ninclude/linux/phy.h-2385-\t\t\t struct ethtool_link_ksettings *cmd);\ninclude/linux/phy.h:2386:int phy_ethtool_ksettings_set(struct phy_device *phydev,\ninclude/linux/phy.h-2387-\t\t\t const struct ethtool_link_ksettings *cmd);\n"
} |
| 9/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 35561 output: 20 thoughts: 704 Thoughts: **Analyzing the Bitmap Operations** Okay, let's dive back into `lib/bitmap.c`. The patch focuses on modifying `__bitmap_and`, `__bitmap_and_and`, and `__bitmap_and_andnot`. I need to carefully review the diff and the implementations of these functions. The core of the functionality seems to revolve around this `BITMAP_OP` macro. It looks like it's a helper macro to perform bitwise operations on bitmaps. The macro iterates through words of the bitmaps, applying a provided `FETCH` expression, and combines the results. It also handles the final word, which might be shorter than a full `unsigned long`. The return value indicates whether any bits were set in the destination. Now, I should check how these functions are actually used, and more specifically, I need to know under what conditions are `__bitmap_and` and its friends are called, versus their inlines. It looks like `__bitmap_and` (and by extension the others, probably) is called when the `bitmap_and` variant is invoked with a non-constant `nbits` argument or where `nbits` is larger than `BITS_PER_LONG`. This makes sense because the optimized inlines would be unable to handle those variable lengths. For example, looking at the `cpumask` implementation: if `NR_CPUS` is greater than 64, `cpumask_and` calls `bitmap_and` with `nr_cpumask_bits`. Given that `nr_cpumask_bits` is a variable (especially in configurations where `NR_CPUS` is dynamic, or even if constant but > 64), `cpumask_and` will be calling `__bitmap_and`! I need to quickly verify this in `include/linux/cpumask.h` to confirm the logic. |
| 10/2 | 2026/09/08 02:07 | tool | grepper |
0mArgs:{
"Expression": "cpumask_and\\("
}Results: {
"Output": "\nFull output is too long, showing 500 out of 775 lines.\nUse more precise expression if possible.\n\nDocumentation/bpf/cpumasks.rst=273=callers can also perform bitwise operations between multiple cpumasks using\nDocumentation/bpf/cpumasks.rst:274:bpf_cpumask_and(), bpf_cpumask_or(), and bpf_cpumask_xor():\nDocumentation/bpf/cpumasks.rst-275-\n--\nDocumentation/bpf/cpumasks.rst=280=kfuncs shown in this example will be covered in more detail below.\n--\nDocumentation/bpf/cpumasks.rst-306- bpf_cpumask_set_cpu(1, mask2);\nDocumentation/bpf/cpumasks.rst:307: bpf_cpumask_and(dst1, (const struct cpumask *)mask1, (const struct cpumask *)mask2);\nDocumentation/bpf/cpumasks.rst-308- if (!bpf_cpumask_empty((const struct cpumask *)dst1))\n--\narch/arc/kernel/mcip.c=264=idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,\n--\narch/arc/kernel/mcip.c-272-\t/* errout if no online cpu per @cpumask */\narch/arc/kernel/mcip.c:273:\tif (!cpumask_and(\u0026online, cpumask, cpu_online_mask))\narch/arc/kernel/mcip.c-274-\t\treturn -EINVAL;\n--\narch/mips/kernel/mips-mt-fpaff.c=66=asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,\n--\narch/mips/kernel/mips-mt-fpaff.c-124-\t cpumask_intersects(new_mask, \u0026mt_fpu_cpumask)) {\narch/mips/kernel/mips-mt-fpaff.c:125:\t\tcpumask_and(effective_mask, new_mask, \u0026mt_fpu_cpumask);\narch/mips/kernel/mips-mt-fpaff.c-126-\t\tretval = set_cpus_allowed_ptr(p, effective_mask);\n--\narch/mips/kernel/mips-mt-fpaff.c=160=asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,\n--\narch/mips/kernel/mips-mt-fpaff.c-183-\tcpumask_or(\u0026allowed, \u0026p-\u003ethread.user_cpus_allowed, p-\u003ecpus_ptr);\narch/mips/kernel/mips-mt-fpaff.c:184:\tcpumask_and(\u0026mask, \u0026allowed, cpu_active_mask);\narch/mips/kernel/mips-mt-fpaff.c-185-\n--\narch/mips/kernel/pm-cps.c=101=int cps_pm_enter_state(enum cps_pm_state state)\n--\narch/mips/kernel/pm-cps.c-123-\tif (cpu_online(cpu)) {\narch/mips/kernel/pm-cps.c:124:\t\tcpumask_and(coupled_mask, cpu_online_mask,\narch/mips/kernel/pm-cps.c-125-\t\t\t \u0026cpu_sibling_map[cpu]);\n--\narch/mips/kernel/traps.c=935=static void mt_ase_fp_affinity(void)\n--\narch/mips/kernel/traps.c-949-\t\t\t\t= current-\u003ecpus_mask;\narch/mips/kernel/traps.c:950:\t\t\tcpumask_and(\u0026tmask, \u0026current-\u003ecpus_mask,\narch/mips/kernel/traps.c-951-\t\t\t\t \u0026mt_fpu_cpumask);\n--\narch/mips/lantiq/irq.c=244=static int ltq_icu_irq_set_affinity(struct irq_data *d,\n--\narch/mips/lantiq/irq.c-248-\narch/mips/lantiq/irq.c:249:\tif (!cpumask_and(\u0026tmask, cpumask, cpu_online_mask))\narch/mips/lantiq/irq.c-250-\t\treturn -EINVAL;\n--\narch/powerpc/kernel/smp.c=1434=static bool update_mask_by_l2(int cpu, cpumask_var_t *mask)\n--\narch/powerpc/kernel/smp.c-1473-\narch/powerpc/kernel/smp.c:1474:\tcpumask_and(*mask, cpu_online_mask, cpu_node_mask(cpu));\narch/powerpc/kernel/smp.c-1475-\n--\narch/powerpc/kernel/smp.c=1547=static void update_coregroup_mask(int cpu, cpumask_var_t *mask)\n--\narch/powerpc/kernel/smp.c-1563-\narch/powerpc/kernel/smp.c:1564:\tcpumask_and(*mask, cpu_online_mask, cpu_node_mask(cpu));\narch/powerpc/kernel/smp.c-1565-\n--\narch/powerpc/kernel/smp.c=1583=static void add_cpu_to_masks(int cpu)\n--\narch/powerpc/kernel/smp.c-1626-\tif (chip_id == -1)\narch/powerpc/kernel/smp.c:1627:\t\tcpumask_and(mask, mask, cpu_node_mask(cpu));\narch/powerpc/kernel/smp.c-1628-\n--\narch/riscv/kernel/sys_hwprobe.c=379=static int hwprobe_get_values(struct riscv_hwprobe __user *pairs,\n--\narch/riscv/kernel/sys_hwprobe.c-411-\t\t */\narch/riscv/kernel/sys_hwprobe.c:412:\t\tcpumask_and(\u0026cpus, \u0026cpus, cpu_online_mask);\narch/riscv/kernel/sys_hwprobe.c-413-\t\tif (cpumask_empty(\u0026cpus))\n--\narch/riscv/kernel/sys_hwprobe.c=436=static int hwprobe_get_cpus(struct riscv_hwprobe __user *pairs,\n--\narch/riscv/kernel/sys_hwprobe.c-462-\narch/riscv/kernel/sys_hwprobe.c:463:\tcpumask_and(\u0026cpus, \u0026cpus, cpu_online_mask);\narch/riscv/kernel/sys_hwprobe.c-464-\n--\narch/s390/kernel/perf_cpum_cf.c=1438=static void cfset_all_stop(struct cfset_request *req)\n--\narch/s390/kernel/perf_cpum_cf.c-1443-\narch/s390/kernel/perf_cpum_cf.c:1444:\tcpumask_and(\u0026req-\u003emask, \u0026req-\u003emask, cpu_online_mask);\narch/s390/kernel/perf_cpum_cf.c-1445-\ton_each_cpu_mask(\u0026req-\u003emask, cfset_ioctl_off, \u0026p, 1);\n--\narch/s390/kernel/perf_cpum_cf.c=1502=static int cfset_all_start(struct cfset_request *req)\n--\narch/s390/kernel/perf_cpum_cf.c-1512-\t\treturn -ENOMEM;\narch/s390/kernel/perf_cpum_cf.c:1513:\tcpumask_and(mask, \u0026req-\u003emask, cpu_online_mask);\narch/s390/kernel/perf_cpum_cf.c-1514-\ton_each_cpu_mask(mask, cfset_ioctl_on, \u0026p, 1);\n--\narch/s390/kernel/perf_cpum_cf.c=1623=static int cfset_all_read(unsigned long arg, struct cfset_request *req)\n--\narch/s390/kernel/perf_cpum_cf.c-1632-\tp.sets = req-\u003ectrset;\narch/s390/kernel/perf_cpum_cf.c:1633:\tcpumask_and(mask, \u0026req-\u003emask, cpu_online_mask);\narch/s390/kernel/perf_cpum_cf.c-1634-\ton_each_cpu_mask(mask, cfset_cpu_read, \u0026p, 1);\n--\narch/s390/kernel/topology.c=67=static void cpu_group_map(cpumask_t *dst, struct mask_info *info, unsigned int cpu)\n--\narch/s390/kernel/topology.c-92-\t}\narch/s390/kernel/topology.c:93:\tcpumask_and(\u0026mask, \u0026mask, \u0026cpu_setup_mask);\narch/s390/kernel/topology.c-94-out:\n--\narch/sparc/kernel/leon_smp.c=375=static void leon_cross_call(void *func, cpumask_t mask, unsigned long arg1,\n--\narch/sparc/kernel/leon_smp.c-406-\t\t\tcpumask_clear_cpu(smp_processor_id(), \u0026mask);\narch/sparc/kernel/leon_smp.c:407:\t\t\tcpumask_and(\u0026mask, cpu_online_mask, \u0026mask);\narch/sparc/kernel/leon_smp.c-408-\t\t\tfor (i = 0; i \u003c= high; i++) {\n--\narch/sparc/kernel/sun4d_smp.c=284=static void sun4d_cross_call(void *func, cpumask_t mask, unsigned long arg1,\n--\narch/sparc/kernel/sun4d_smp.c-318-\t\t\tcpumask_clear_cpu(smp_processor_id(), \u0026mask);\narch/sparc/kernel/sun4d_smp.c:319:\t\t\tcpumask_and(\u0026mask, cpu_online_mask, \u0026mask);\narch/sparc/kernel/sun4d_smp.c-320-\t\t\tfor (i = 0; i \u003c= high; i++) {\n--\narch/sparc/kernel/sun4m_smp.c=173=static void sun4m_cross_call(void *func, cpumask_t mask, unsigned long arg1,\n--\narch/sparc/kernel/sun4m_smp.c-194-\t\t\tcpumask_clear_cpu(smp_processor_id(), \u0026mask);\narch/sparc/kernel/sun4m_smp.c:195:\t\t\tcpumask_and(\u0026mask, cpu_online_mask, \u0026mask);\narch/sparc/kernel/sun4m_smp.c-196-\t\t\tfor (i = 0; i \u003c ncpus; i++) {\n--\narch/x86/kernel/apic/vector.c=275=static int assign_irq_vector(struct irq_data *irqd, const struct cpumask *dest)\n--\narch/x86/kernel/apic/vector.c-280-\traw_spin_lock_irqsave(\u0026vector_lock, flags);\narch/x86/kernel/apic/vector.c:281:\tcpumask_and(vector_searchmask, dest, cpu_online_mask);\narch/x86/kernel/apic/vector.c-282-\tret = assign_vector_locked(irqd, vector_searchmask);\n--\narch/x86/kernel/apic/vector.c=287=static int assign_irq_vector_any_locked(struct irq_data *irqd)\n--\narch/x86/kernel/apic/vector.c-294-\t\t/* Try the intersection of @affmsk and node mask */\narch/x86/kernel/apic/vector.c:295:\t\tcpumask_and(vector_searchmask, cpumask_of_node(node), affmsk);\narch/x86/kernel/apic/vector.c-296-\t\tif (!assign_vector_locked(irqd, vector_searchmask))\n--\narch/x86/kernel/apic/vector.c-300-\t/* Try the full affinity mask */\narch/x86/kernel/apic/vector.c:301:\tcpumask_and(vector_searchmask, affmsk, cpu_online_mask);\narch/x86/kernel/apic/vector.c-302-\tif (!assign_vector_locked(irqd, vector_searchmask))\n--\narch/x86/kernel/apic/vector.c=330=assign_managed_vector(struct irq_data *irqd, const struct cpumask *dest)\n--\narch/x86/kernel/apic/vector.c-335-\narch/x86/kernel/apic/vector.c:336:\tcpumask_and(vector_searchmask, dest, affmsk);\narch/x86/kernel/apic/vector.c-337-\n--\narch/x86/kernel/apic/vector.c=437=static int activate_managed(struct irq_data *irqd)\n--\narch/x86/kernel/apic/vector.c-441-\narch/x86/kernel/apic/vector.c:442:\tcpumask_and(vector_searchmask, dest, cpu_online_mask);\narch/x86/kernel/apic/vector.c-443-\tif (WARN_ON_ONCE(cpumask_empty(vector_searchmask))) {\n--\narch/x86/kernel/apic/vector.c=879=static int apic_set_affinity(struct irq_data *irqd,\n--\narch/x86/kernel/apic/vector.c-887-\traw_spin_lock(\u0026vector_lock);\narch/x86/kernel/apic/vector.c:888:\tcpumask_and(vector_searchmask, dest, cpu_online_mask);\narch/x86/kernel/apic/vector.c-889-\tif (irqd_affinity_is_managed(irqd))\n--\narch/x86/kernel/cpu/mce/core.c=1013=static noinstr int mce_timed_out(u64 *t, const char *msg)\n--\narch/x86/kernel/cpu/mce/core.c-1031-\tif ((s64)*t \u003c SPINUNIT) {\narch/x86/kernel/cpu/mce/core.c:1032:\t\tif (cpumask_and(\u0026mce_missing_cpus, cpu_online_mask, \u0026mce_missing_cpus))\narch/x86/kernel/cpu/mce/core.c-1033-\t\t\tpr_emerg(\"CPUs not responding to MCE broadcast (may include false positives): %*pbl\\n\",\n--\narch/x86/xen/mmu_pv.c=1337=static void xen_flush_tlb_multi(const struct cpumask *cpus,\n--\narch/x86/xen/mmu_pv.c-1357-\t/* Remove any offline CPUs */\narch/x86/xen/mmu_pv.c:1358:\tcpumask_and(to_cpumask(args-\u003emask), cpus, cpu_online_mask);\narch/x86/xen/mmu_pv.c-1359-\n--\ndrivers/accel/habanalabs/common/device.c=2872=void hl_init_cpu_for_irq(struct hl_device *hdev)\n--\ndrivers/accel/habanalabs/common/device.c-2881-\ndrivers/accel/habanalabs/common/device.c:2882:\tif (!cpumask_and(\u0026cpu_mask, cpumask_of_node(numa_node), cpu_online_mask)) {\ndrivers/accel/habanalabs/common/device.c-2883-\t\tdev_err(hdev-\u003edev, \"No available affinities in current numa node\\n\");\n--\ndrivers/base/node.c=31=static inline ssize_t cpumap_read(struct file *file, struct kobject *kobj,\n--\ndrivers/base/node.c-42-\ndrivers/base/node.c:43:\tcpumask_and(mask, cpumask_of_node(node_dev-\u003edev.id), cpu_online_mask);\ndrivers/base/node.c-44-\tn = cpumap_print_bitmask_to_buf(buf, mask, off, count);\n--\ndrivers/base/node.c=52=static inline ssize_t cpulist_read(struct file *file, struct kobject *kobj,\n--\ndrivers/base/node.c-63-\ndrivers/base/node.c:64:\tcpumask_and(mask, cpumask_of_node(node_dev-\u003edev.id), cpu_online_mask);\ndrivers/base/node.c-65-\tn = cpumap_print_list_to_buf(buf, mask, off, count);\n--\ndrivers/block/drbd/drbd_main.c=2461=int set_resource_options(struct drbd_resource *resource, struct res_opts *res_opts)\n--\ndrivers/block/drbd/drbd_main.c-2478-\t\t\t\tcpumask_setall(tmp_cpu_mask);\ndrivers/block/drbd/drbd_main.c:2479:\t\t\t\tcpumask_and(new_cpu_mask, new_cpu_mask, tmp_cpu_mask);\ndrivers/block/drbd/drbd_main.c-2480-\t\t\t\tdrbd_warn(resource, \"Overflow in bitmap_parse(%.12s%s), truncating to %u bits\\n\",\n--\ndrivers/char/random.c=1277=static void __cold try_to_generate_entropy(void)\n--\ndrivers/char/random.c-1316-\t\t\t/* Only schedule callbacks on timer CPUs that are online. */\ndrivers/char/random.c:1317:\t\t\tcpumask_and(timer_cpus, housekeeping_cpumask(HK_TYPE_TIMER), cpu_online_mask);\ndrivers/char/random.c-1318-\t\t\tnum_cpus = cpumask_weight(timer_cpus);\n--\ndrivers/cpufreq/cpufreq.c=1407=static int cpufreq_policy_online(struct cpufreq_policy *policy,\n--\ndrivers/cpufreq/cpufreq.c-1472-\t */\ndrivers/cpufreq/cpufreq.c:1473:\tcpumask_and(policy-\u003ecpus, policy-\u003ecpus, cpu_online_mask);\ndrivers/cpufreq/cpufreq.c-1474-\n--\ndrivers/cpufreq/powernv-cpufreq.c=913=static void powernv_cpufreq_work_fn(struct work_struct *work)\n--\ndrivers/cpufreq/powernv-cpufreq.c-920-\tcpus_read_lock();\ndrivers/cpufreq/powernv-cpufreq.c:921:\tcpumask_and(\u0026mask, \u0026chip-\u003emask, cpu_online_mask);\ndrivers/cpufreq/powernv-cpufreq.c-922-\tsmp_call_function_any(\u0026mask,\n--\ndrivers/hv/channel_mgmt.c=749=static void init_vp_index(struct vmbus_channel *channel)\n--\ndrivers/hv/channel_mgmt.c-790-\t\tcpumask_xor(available_mask, allocated_mask, cpumask_of_node(numa_node));\ndrivers/hv/channel_mgmt.c:791:\t\tcpumask_and(available_mask, available_mask, hk_mask);\ndrivers/hv/channel_mgmt.c-792-\n--\ndrivers/infiniband/hw/hfi1/affinity.c=582=int hfi1_dev_affinity_init(struct hfi1_devdata *dd)\n--\ndrivers/infiniband/hw/hfi1/affinity.c-614-\t\t/* Use the \"real\" cpu mask of this node as the default */\ndrivers/infiniband/hw/hfi1/affinity.c:615:\t\tcpumask_and(\u0026entry-\u003edef_intr.mask, \u0026node_affinity.real_cpu_mask,\ndrivers/infiniband/hw/hfi1/affinity.c-616-\t\t\t local_mask);\n--\ndrivers/infiniband/hw/hfi1/affinity.c-665-\t\t/* Determine completion vector CPUs for the entire node */\ndrivers/infiniband/hw/hfi1/affinity.c:666:\t\tcpumask_and(\u0026entry-\u003ecomp_vect_mask,\ndrivers/infiniband/hw/hfi1/affinity.c-667-\t\t\t \u0026node_affinity.real_cpu_mask, local_mask);\n--\ndrivers/infiniband/hw/hfi1/affinity.c=976=int hfi1_get_proc_affinity(int node)\n--\ndrivers/infiniband/hw/hfi1/affinity.c-1093-\t/* Get cpumask of available CPUs on preferred NUMA */\ndrivers/infiniband/hw/hfi1/affinity.c:1094:\tcpumask_and(available_mask, hw_thread_mask, node_mask);\ndrivers/infiniband/hw/hfi1/affinity.c-1095-\tcpumask_andnot(available_mask, available_mask, \u0026set-\u003eused);\n--\ndrivers/infiniband/hw/hfi1/netdev_rx.c=155=u32 hfi1_num_netdev_contexts(struct hfi1_devdata *dd, u32 available_contexts,\n--\ndrivers/infiniband/hw/hfi1/netdev_rx.c-174-\ndrivers/infiniband/hw/hfi1/netdev_rx.c:175:\tcpumask_and(node_cpu_mask, cpu_mask, cpumask_of_node(dd-\u003enode));\ndrivers/infiniband/hw/hfi1/netdev_rx.c-176-\n--\ndrivers/irqchip/irq-gic-v3-its.c=1695=static int its_select_cpu(struct irq_data *d,\n--\ndrivers/irqchip/irq-gic-v3-its.c-1715-\t\t\t */\ndrivers/irqchip/irq-gic-v3-its.c:1716:\t\t\tcpumask_and(tmpmask, cpumask_of_node(node), aff_mask);\ndrivers/irqchip/irq-gic-v3-its.c:1717:\t\t\tcpumask_and(tmpmask, tmpmask, cpu_online_mask);\ndrivers/irqchip/irq-gic-v3-its.c-1718-\n--\ndrivers/irqchip/irq-gic-v3-its.c-1742-\t\t/* Try the intersection of the affinity and online masks */\ndrivers/irqchip/irq-gic-v3-its.c:1743:\t\tcpumask_and(tmpmask, aff_mask, cpu_online_mask);\ndrivers/irqchip/irq-gic-v3-its.c-1744-\n--\ndrivers/irqchip/irq-gic-v3-its.c-1755-\t\t node != NUMA_NO_NODE)\ndrivers/irqchip/irq-gic-v3-its.c:1756:\t\t\tcpumask_and(tmpmask, tmpmask, cpumask_of_node(node));\ndrivers/irqchip/irq-gic-v3-its.c-1757-\n--\ndrivers/irqchip/irq-loongarch-avec.c=92=static int avecintc_set_affinity(struct irq_data *data, const struct cpumask *dest, bool force)\n--\ndrivers/irqchip/irq-loongarch-avec.c-105-\ndrivers/irqchip/irq-loongarch-avec.c:106:\t\tcpumask_and(\u0026intersect_mask, dest, cpu_online_mask);\ndrivers/irqchip/irq-loongarch-avec.c-107-\n--\ndrivers/net/ethernet/sfc/efx_channels.c=55=static unsigned int count_online_cores(struct efx_nic *efx, bool local_node)\n--\ndrivers/net/ethernet/sfc/efx_channels.c-68-\tif (local_node)\ndrivers/net/ethernet/sfc/efx_channels.c:69:\t\tcpumask_and(filter_mask, filter_mask,\ndrivers/net/ethernet/sfc/efx_channels.c-70-\t\t\t cpumask_of_pcibus(efx-\u003epci_dev-\u003ebus));\n--\ndrivers/net/ethernet/sfc/siena/efx_channels.c=55=static unsigned int count_online_cores(struct efx_nic *efx, bool local_node)\n--\ndrivers/net/ethernet/sfc/siena/efx_channels.c-68-\tif (local_node)\ndrivers/net/ethernet/sfc/siena/efx_channels.c:69:\t\tcpumask_and(filter_mask, filter_mask,\ndrivers/net/ethernet/sfc/siena/efx_channels.c-70-\t\t\t cpumask_of_pcibus(efx-\u003epci_dev-\u003ebus));\n--\ndrivers/parisc/dino.c=346=static int dino_set_affinity_irq(struct irq_data *d, const struct cpumask *dest,\n--\ndrivers/parisc/dino.c-353-\ndrivers/parisc/dino.c:354:\tif (!cpumask_and(\u0026tmask, dest, cpu_online_mask))\ndrivers/parisc/dino.c-355-\t\treturn -EINVAL;\n--\ndrivers/parisc/gsc.c=139=static int gsc_set_affinity_irq(struct irq_data *d, const struct cpumask *dest,\n--\ndrivers/parisc/gsc.c-145-\ndrivers/parisc/gsc.c:146:\tif (!cpumask_and(\u0026tmask, dest, cpu_online_mask))\ndrivers/parisc/gsc.c-147-\t\treturn -EINVAL;\n--\ndrivers/pci/controller/pci-hyperv.c=610=static void hv_irq_retarget_interrupt(struct irq_data *data)\n--\ndrivers/pci/controller/pci-hyperv.c-666-\ndrivers/pci/controller/pci-hyperv.c:667:\t\tcpumask_and(tmp, dest, cpu_online_mask);\ndrivers/pci/controller/pci-hyperv.c-668-\t\tnr_bank = cpumask_to_vpset(\u0026params-\u003eint_target.vp_set, tmp);\n--\ndrivers/resctrl/mpam_devices.c=508=static int mpam_ris_get_affinity(struct mpam_msc *msc, cpumask_t *affinity,\n--\ndrivers/resctrl/mpam_devices.c-536-\ndrivers/resctrl/mpam_devices.c:537:\tcpumask_and(affinity, affinity, \u0026msc-\u003eaccessibility);\ndrivers/resctrl/mpam_devices.c-538-\n--\ndrivers/scsi/lpfc/lpfc_init.c=12703=lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu,\n--\ndrivers/scsi/lpfc/lpfc_init.c-12723-\t\t */\ndrivers/scsi/lpfc/lpfc_init.c:12724:\t\tif (!cpumask_and(tmp, maskp, cpumask_of(cpu)))\ndrivers/scsi/lpfc/lpfc_init.c-12725-\t\t\tcontinue;\n--\ndrivers/scsi/lpfc/lpfc_init.c-12731-\t\t */\ndrivers/scsi/lpfc/lpfc_init.c:12732:\t\tcpumask_and(tmp, maskp, cpu_online_mask);\ndrivers/scsi/lpfc/lpfc_init.c-12733-\t\tif (cpumask_weight(tmp) \u003e 1)\n--\ndrivers/target/iscsi/iscsi_target.c=3585=void iscsit_thread_get_cpumask(struct iscsit_conn *conn)\n--\ndrivers/target/iscsi/iscsi_target.c-3606-\t} else {\ndrivers/target/iscsi/iscsi_target.c:3607:\t\tcpumask_and(conn_allowed_cpumask, iscsit_global-\u003eallowed_cpumask,\ndrivers/target/iscsi/iscsi_target.c-3608-\t\t\tcpu_online_mask);\n--\nfs/resctrl/rdtgroup.c=445=static void cpumask_rdtgrp_clear(struct rdtgroup *r, struct cpumask *m)\n--\nfs/resctrl/rdtgroup.c-451-\tlist_for_each_entry(crgrp, \u0026r-\u003emon.crdtgrp_list, mon.crdtgrp_list)\nfs/resctrl/rdtgroup.c:452:\t\tcpumask_and(\u0026crgrp-\u003ecpu_mask, \u0026r-\u003ecpu_mask, \u0026crgrp-\u003ecpu_mask);\nfs/resctrl/rdtgroup.c-453-}\n--\nfs/resctrl/rdtgroup.c=455=static int cpus_ctrl_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask,\n--\nfs/resctrl/rdtgroup.c-485-\t\t\t\tcontinue;\nfs/resctrl/rdtgroup.c:486:\t\t\tcpumask_and(tmpmask1, \u0026r-\u003ecpu_mask, tmpmask);\nfs/resctrl/rdtgroup.c-487-\t\t\tif (!cpumask_empty(tmpmask1))\n--\nfs/resctrl/rdtgroup.c-501-\tlist_for_each_entry(crgrp, head, mon.crdtgrp_list) {\nfs/resctrl/rdtgroup.c:502:\t\tcpumask_and(tmpmask, \u0026rdtgrp-\u003ecpu_mask, \u0026crgrp-\u003ecpu_mask);\nfs/resctrl/rdtgroup.c-503-\t\tupdate_closid_rmid(tmpmask, rdtgrp);\n--\ninclude/linux/cpumask.h=368=unsigned int cpumask_random(const struct cpumask *src)\n--\ninclude/linux/cpumask.h-403- *\tstruct cpumask tmp;\ninclude/linux/cpumask.h:404: *\tcpumask_and(\u0026tmp, \u0026mask1, \u0026mask2);\ninclude/linux/cpumask.h-405- *\tfor_each_cpu(cpu, \u0026tmp)\n--\ninclude/linux/cpumask.h=713=static __always_inline\ninclude/linux/cpumask.h:714:bool cpumask_and(struct cpumask *dstp, const struct cpumask *src1p,\ninclude/linux/cpumask.h-715-\t\t const struct cpumask *src2p)\n--\nkernel/bpf/cpumask.c=251=__bpf_kfunc void bpf_cpumask_clear(struct bpf_cpumask *cpumask)\n--\nkernel/bpf/cpumask.c-256-/**\nkernel/bpf/cpumask.c:257: * bpf_cpumask_and() - AND two cpumasks and store the result.\nkernel/bpf/cpumask.c-258- * @dst: The BPF cpumask where the result is being stored.\n--\nkernel/bpf/cpumask.c-267- */\nkernel/bpf/cpumask.c:268:__bpf_kfunc bool bpf_cpumask_and(struct bpf_cpumask *dst,\nkernel/bpf/cpumask.c-269-\t\t\t\t const struct cpumask *src1,\n--\nkernel/bpf/cpumask.c-271-{\nkernel/bpf/cpumask.c:272:\treturn cpumask_and((struct cpumask *)dst, src1, src2);\nkernel/bpf/cpumask.c-273-}\n--\nkernel/cgroup/cpuset-v1.c=624=int cpuset1_generate_sched_domains(cpumask_var_t **domains,\n--\nkernel/cgroup/cpuset-v1.c-655-\t\t}\nkernel/cgroup/cpuset-v1.c:656:\t\tcpumask_and(doms[0], top_cpuset.effective_cpus,\nkernel/cgroup/cpuset-v1.c-657-\t\t\t housekeeping_cpumask(HK_TYPE_DOMAIN));\n--\nkernel/cgroup/cpuset-v1.c-739-\t\t\t\tcpumask_or(dp, dp, csa[j]-\u003eeffective_cpus);\nkernel/cgroup/cpuset-v1.c:740:\t\t\t\tcpumask_and(dp, dp, housekeeping_cpumask(HK_TYPE_DOMAIN));\nkernel/cgroup/cpuset-v1.c-741-\t\t\t\tif (dattr)\n--\nkernel/cgroup/cpuset.c=504=static void guarantee_active_cpus(struct task_struct *tsk,\n--\nkernel/cgroup/cpuset.c-509-\nkernel/cgroup/cpuset.c:510:\tif (WARN_ON(!cpumask_and(pmask, possible_mask, cpu_active_mask)))\nkernel/cgroup/cpuset.c-511-\t\tcpumask_copy(pmask, cpu_active_mask);\n--\nkernel/cgroup/cpuset.c-518-\nkernel/cgroup/cpuset.c:519:\tcpumask_and(pmask, pmask, cs-\u003eeffective_cpus);\nkernel/cgroup/cpuset.c-520-\trcu_read_unlock();\n--\nkernel/cgroup/cpuset.c=850=static int generate_sched_domains(cpumask_var_t **domains,\n--\nkernel/cgroup/cpuset.c-931-\t\tif (!csa || csa[i] == \u0026top_cpuset)\nkernel/cgroup/cpuset.c:932:\t\t\tcpumask_and(doms[i], top_cpuset.effective_cpus,\nkernel/cgroup/cpuset.c-933-\t\t\t\t housekeeping_cpumask(HK_TYPE_DOMAIN_BOOT));\n--\nkernel/cgroup/cpuset.c=1099=void cpuset_update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cpus)\n--\nkernel/cgroup/cpuset.c-1117-\t\t} else {\nkernel/cgroup/cpuset.c:1118:\t\t\tcpumask_and(new_cpus, possible_mask, cs-\u003eeffective_cpus);\nkernel/cgroup/cpuset.c-1119-\t\t}\n--\nkernel/cgroup/cpuset.c=1134=static void compute_effective_cpumask(struct cpumask *new_cpus,\n--\nkernel/cgroup/cpuset.c-1138-\nkernel/cgroup/cpuset.c:1139:\thas_cpus = cpumask_and(new_cpus, cs-\u003ecpus_allowed, parent-\u003eeffective_cpus);\nkernel/cgroup/cpuset.c-1140-\tif (!has_cpus \u0026\u0026 is_in_v2_mode())\n--\nkernel/cgroup/cpuset.c=1244=static void reset_partition_data(struct cpuset *cs)\n--\nkernel/cgroup/cpuset.c-1257-\t}\nkernel/cgroup/cpuset.c:1258:\tif (!cpumask_and(cs-\u003eeffective_cpus, parent-\u003eeffective_cpus, cs-\u003ecpus_allowed))\nkernel/cgroup/cpuset.c-1259-\t\tcpumask_copy(cs-\u003eeffective_cpus, parent-\u003eeffective_cpus);\n--\nkernel/cgroup/cpuset.c=1320=static void partition_xcpus_del(int old_prs, struct cpuset *parent,\n--\nkernel/cgroup/cpuset.c-1335-\tcpumask_or(parent-\u003eeffective_cpus, parent-\u003eeffective_cpus, xcpus);\nkernel/cgroup/cpuset.c:1336:\tcpumask_and(parent-\u003eeffective_cpus, parent-\u003eeffective_cpus, cpu_active_mask);\nkernel/cgroup/cpuset.c-1337-}\n--\nkernel/cgroup/cpuset.c=1351=static bool isolated_cpus_can_update(struct cpumask *add_cpus,\n--\nkernel/cgroup/cpuset.c-1366-\nkernel/cgroup/cpuset.c:1367:\tcpumask_and(full_hk_cpus, housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),\nkernel/cgroup/cpuset.c-1368-\t\t housekeeping_cpumask(HK_TYPE_DOMAIN));\nkernel/cgroup/cpuset.c-1369-\tcpumask_andnot(full_hk_cpus, full_hk_cpus, isolated_cpus);\nkernel/cgroup/cpuset.c:1370:\tcpumask_and(full_hk_cpus, full_hk_cpus, cpu_active_mask);\nkernel/cgroup/cpuset.c-1371-\tif (!cpumask_weight_andnot(full_hk_cpus, add_cpus))\n--\nkernel/cgroup/cpuset.c=1499=static int compute_excpus(struct cpuset *cs, struct cpumask *excpus)\n--\nkernel/cgroup/cpuset.c-1502-\nkernel/cgroup/cpuset.c:1503:\tcpumask_and(excpus, user_xcpus(cs), parent-\u003eeffective_xcpus);\nkernel/cgroup/cpuset.c-1504-\n--\nkernel/cgroup/cpuset.c=1520=static int compute_trialcs_excpus(struct cpuset *trialcs, struct cpuset *cs)\n--\nkernel/cgroup/cpuset.c-1526-\tif (cs_is_member(cs))\nkernel/cgroup/cpuset.c:1527:\t\tcpumask_and(excpus, trialcs-\u003eexclusive_cpus,\nkernel/cgroup/cpuset.c-1528-\t\t\t\tparent-\u003eeffective_xcpus);\nkernel/cgroup/cpuset.c-1529-\telse\nkernel/cgroup/cpuset.c:1530:\t\tcpumask_and(excpus, user_xcpus(trialcs), parent-\u003eeffective_xcpus);\nkernel/cgroup/cpuset.c-1531-\n--\nkernel/cgroup/cpuset.c=1754=static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,\n--\nkernel/cgroup/cpuset.c-1784-\t\tif (is_partition_valid(parent))\nkernel/cgroup/cpuset.c:1785:\t\t\tadding = cpumask_and(tmp-\u003eaddmask,\nkernel/cgroup/cpuset.c-1786-\t\t\t\t\t cs-\u003eeffective_xcpus,\n--\nkernel/cgroup/cpuset.c-1844-\t\t */\nkernel/cgroup/cpuset.c:1845:\t\tcpumask_and(tmp-\u003enew_cpus, xcpus, cpu_active_mask);\nkernel/cgroup/cpuset.c-1846-\t\tWARN_ON_ONCE(!cpumask_subset(tmp-\u003enew_cpus, parent-\u003eeffective_cpus));\n--\nkernel/cgroup/cpuset.c-1889-\t\t\tadding = false;\nkernel/cgroup/cpuset.c:1890:\t\t\tdeleting = cpumask_and(tmp-\u003edelmask,\nkernel/cgroup/cpuset.c-1891-\t\t\t\t\tnewmask, parent-\u003eeffective_xcpus);\n--\nkernel/cgroup/cpuset.c-1893-\t\t\tcpumask_andnot(tmp-\u003eaddmask, cs-\u003eeffective_xcpus, newmask);\nkernel/cgroup/cpuset.c:1894:\t\t\tadding = cpumask_and(tmp-\u003eaddmask, tmp-\u003eaddmask,\nkernel/cgroup/cpuset.c-1895-\t\t\t\t\t parent-\u003eeffective_xcpus);\n--\nkernel/cgroup/cpuset.c-1897-\t\t\tcpumask_andnot(tmp-\u003edelmask, newmask, cs-\u003eeffective_xcpus);\nkernel/cgroup/cpuset.c:1898:\t\t\tdeleting = cpumask_and(tmp-\u003edelmask, tmp-\u003edelmask,\nkernel/cgroup/cpuset.c-1899-\t\t\t\t\t parent-\u003eeffective_xcpus);\n--\nkernel/cgroup/cpuset.c-1922-\t\tif (deleting) {\nkernel/cgroup/cpuset.c:1923:\t\t\tcpumask_and(tmp-\u003enew_cpus, tmp-\u003edelmask, cpu_active_mask);\nkernel/cgroup/cpuset.c-1924-\t\t\tWARN_ON_ONCE(!cpumask_subset(tmp-\u003enew_cpus, parent-\u003eeffective_cpus));\n--\nkernel/cgroup/cpuset.c-1934-\t\t\tdeleting = false;\nkernel/cgroup/cpuset.c:1935:\t\t\tadding = cpumask_and(tmp-\u003eaddmask,\nkernel/cgroup/cpuset.c-1936-\t\t\t\t\t cs-\u003eeffective_xcpus, parent-\u003eeffective_xcpus);\n--\nkernel/cgroup/cpuset.c-1956-\t\t\tif (is_partition_valid(cs))\nkernel/cgroup/cpuset.c:1957:\t\t\t\tadding = cpumask_and(tmp-\u003eaddmask,\nkernel/cgroup/cpuset.c-1958-\t\t\t\t\t\t cs-\u003eeffective_xcpus,\n--\nkernel/cgroup/cpuset.c-1980-\t\t\tif (exclusive)\nkernel/cgroup/cpuset.c:1981:\t\t\t\tdeleting = cpumask_and(tmp-\u003edelmask,\nkernel/cgroup/cpuset.c-1982-\t\t\t\t\t\txcpus, parent-\u003eeffective_cpus);\n--\nkernel/cgroup/cpuset.c=2085=static void compute_partition_effective_cpumask(struct cpuset *cs,\n--\nkernel/cgroup/cpuset.c-2100-\tcompute_excpus(cs, new_ecpus);\nkernel/cgroup/cpuset.c:2101:\tcpumask_and(new_ecpus, new_ecpus, cpu_active_mask);\nkernel/cgroup/cpuset.c-2102-\n--\nkernel/cpu.c=1831=static bool __init cpuhp_bringup_cpus_parallel(unsigned int ncpus)\n--\nkernel/cpu.c-1848-\t\t */\nkernel/cpu.c:1849:\t\tcpumask_and(\u0026tmp_mask, mask, pmask);\nkernel/cpu.c-1850-\t\tcpuhp_bringup_mask(\u0026tmp_mask, ncpus, CPUHP_BP_KICK_AP);\n--\nkernel/irq/manage.c=233=int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)\n--\nkernel/irq/manage.c-268-\nkernel/irq/manage.c:269:\t\tcpumask_and(tmp_mask, mask, hk_mask);\nkernel/irq/manage.c-270-\t\tif (!cpumask_intersects(tmp_mask, cpu_online_mask))\n--\nkernel/irq/manage.c-282-\t */\nkernel/irq/manage.c:283:\tcpumask_and(tmp_mask, prog_mask, cpu_online_mask);\nkernel/irq/manage.c-284-\tif (!force \u0026\u0026 !cpumask_empty(tmp_mask))\n--\nkernel/irq/manage.c=593=int irq_setup_affinity(struct irq_desc *desc)\n--\nkernel/irq/manage.c-618-\nkernel/irq/manage.c:619:\tcpumask_and(\u0026mask, cpu_online_mask, set);\nkernel/irq/manage.c-620-\tif (cpumask_empty(\u0026mask))\n--\nkernel/irq/manage.c-627-\t\tif (cpumask_intersects(\u0026mask, nodemask))\nkernel/irq/manage.c:628:\t\t\tcpumask_and(\u0026mask, \u0026mask, nodemask);\nkernel/irq/manage.c-629-\t}\n--\nkernel/kthread.c=330=static void kthread_fetch_affinity(struct kthread *kthread, struct cpumask *cpumask)\n--\nkernel/kthread.c-344-\nkernel/kthread.c:345:\tcpumask_and(cpumask, pref, housekeeping_cpumask(HK_TYPE_DOMAIN));\nkernel/kthread.c-346-\tif (cpumask_empty(cpumask))\n--\nkernel/padata.c=538=static struct parallel_data *padata_alloc_pd(struct padata_shell *ps,\n--\nkernel/padata.c-562-\n\n"
} |
| 11/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 48487 output: 29 thoughts: 447 Thoughts: **Analyzing Bitwise Operations and Reachability in the Linux Kernel** Okay, so I'm diving into these bitwise operations, specifically `cpumask_and`, `bitmap_and`, and `linkmode_and`. My immediate thought is to examine how these functions are implemented and their potential use cases. I see `cpumask_and` at `include/linux/cpumask.h` line 714, and it's calling `bitmap_and`. The `bpf_cpumask_and` also calls `cpumask_and`. Further down the chain, `linkmode_and`, `linkmode_and_and`, and `linkmode_and_andnot` in `include/linux/linkmode.h` are all leveraging `bitmap_and` and its variants. This seems pretty fundamental, but I need to confirm its practical relevance. My next concern is reachability: can I trigger this code in a standard environment? I confirm that `lib/bitmap.c`, where `__bitmap_and`, `__bitmap_and_and`, and `__bitmap_and_andnot` are defined, is compiled into `vmlinux` for every single Linux kernel configuration – so that's a check! I see that these `linkmode_*` functions are clearly related to networking, as they're utilized within the ethtool framework and its PHY subsystem, which would be reachable through things like `phy_ethtool_ksettings_set`, `ixgbe_get_eee_fw`, and `r8152_get_eee`. Now, if I think about `phy_ethtool_ksettings_set`, it is called using standard socket `ioctl(SIOCETHTOOL)` / generic netlink ethtool `ETHTOOL_MSG_LINKMODES_SET`. This gives me the specific hooks to trace up to those functions, and how they get called. I'm going to look at the `net/ethtool/` directory to see if there is any more relevant use of `phy_ethtool_ksettings_set` or `linkmode_and`. |
| 12/2 | 2026/09/08 02:07 | tool | grepper |
0mError:no matches Args: {
"Expression": "linkmode_and",
"PathPrefix": "net/ethtool"
}Results: {
"error": "no matches"
} |
| 13/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 49437 output: 31 thoughts: 33 Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue: **Investigating `phy_ethtool_ksettings_set` Calls** Alright, I need to understand how this `phy_ethtool_ksettings_set` function is being used. Where's it being called from? My first instinct is to jump into the `net/ethtool/linkmodes.c` file, or perhaps something analogous within the network device driver codebase. That's the logical place to start looking for interactions related to setting link modes and speed configurations, especially given the "ethtool" naming. I'll need to trace the call paths to see what's triggering this function and under what circumstances. I'm expecting to find the standard ethtool interface calls here, but I need to confirm the exact context. |
| 14/2 | 2026/09/08 02:07 | tool | grepper |
0mArgs:{
"Expression": "set_link_ksettings",
"PathPrefix": "net/ethtool"
}Results: {
"Output": "net/ethtool/ioctl.c=541=static int ethtool_get_link_ksettings(struct net_device *dev,\n--\nnet/ethtool/ioctl.c-597-/* Update device ethtool_link_settings. */\nnet/ethtool/ioctl.c:598:static int ethtool_set_link_ksettings(struct net_device *dev,\nnet/ethtool/ioctl.c-599-\t\t\t\t void __user *useraddr)\n--\nnet/ethtool/ioctl.c-605-\nnet/ethtool/ioctl.c:606:\tif (!dev-\u003eethtool_ops-\u003eset_link_ksettings)\nnet/ethtool/ioctl.c-607-\t\treturn -EOPNOTSUPP;\n--\nnet/ethtool/ioctl.c-633-\nnet/ethtool/ioctl.c:634:\terr = dev-\u003eethtool_ops-\u003eset_link_ksettings(dev, \u0026link_ksettings);\nnet/ethtool/ioctl.c-635-\tif (err \u003e= 0) {\n--\nnet/ethtool/ioctl.c-641-\nnet/ethtool/ioctl.c:642:int ethtool_virtdev_set_link_ksettings(struct net_device *dev,\nnet/ethtool/ioctl.c-643-\t\t\t\t const struct ethtool_link_ksettings *cmd,\n--\nnet/ethtool/ioctl.c-660-}\nnet/ethtool/ioctl.c:661:EXPORT_SYMBOL(ethtool_virtdev_set_link_ksettings);\nnet/ethtool/ioctl.c-662-\n--\nnet/ethtool/ioctl.c=708=static int ethtool_set_settings(struct net_device *dev, void __user *useraddr)\n--\nnet/ethtool/ioctl.c-717-\t\treturn -EFAULT;\nnet/ethtool/ioctl.c:718:\tif (!dev-\u003eethtool_ops-\u003eset_link_ksettings)\nnet/ethtool/ioctl.c-719-\t\treturn -EOPNOTSUPP;\n--\nnet/ethtool/ioctl.c-724-\t\t__ETHTOOL_LINK_MODE_MASK_NU32;\nnet/ethtool/ioctl.c:725:\tret = dev-\u003eethtool_ops-\u003eset_link_ksettings(dev, \u0026link_ksettings);\nnet/ethtool/ioctl.c-726-\tif (ret \u003e= 0) {\n--\nnet/ethtool/ioctl.c=3272=dev_ethtool_locked(struct net *net, struct net_device *dev,\n--\nnet/ethtool/ioctl.c-3545-\tcase ETHTOOL_SLINKSETTINGS:\nnet/ethtool/ioctl.c:3546:\t\trc = ethtool_set_link_ksettings(dev, useraddr);\nnet/ethtool/ioctl.c-3547-\t\tbreak;\n--\nnet/ethtool/linkinfo.c=87=ethnl_set_linkinfo_validate(struct ethnl_req_info *req_info,\n--\nnet/ethtool/linkinfo.c-91-\nnet/ethtool/linkinfo.c:92:\tif (!ops-\u003eget_link_ksettings || !ops-\u003eset_link_ksettings)\nnet/ethtool/linkinfo.c-93-\t\treturn -EOPNOTSUPP;\n--\nnet/ethtool/linkinfo.c=98=ethnl_set_linkinfo(struct ethnl_req_info *req_info, struct genl_info *info)\n--\nnet/ethtool/linkinfo.c-121-\nnet/ethtool/linkinfo.c:122:\tret = dev-\u003eethtool_ops-\u003eset_link_ksettings(dev, \u0026ksettings);\nnet/ethtool/linkinfo.c-123-\tif (ret \u003c 0) {\n--\nnet/ethtool/linkmodes.c=303=ethnl_set_linkmodes_validate(struct ethnl_req_info *req_info,\n--\nnet/ethtool/linkmodes.c-312-\nnet/ethtool/linkmodes.c:313:\tif (!ops-\u003eget_link_ksettings || !ops-\u003eset_link_ksettings)\nnet/ethtool/linkmodes.c-314-\t\treturn -EOPNOTSUPP;\n--\nnet/ethtool/linkmodes.c=319=ethnl_set_linkmodes(struct ethnl_req_info *req_info, struct genl_info *info)\n--\nnet/ethtool/linkmodes.c-338-\nnet/ethtool/linkmodes.c:339:\tret = dev-\u003eethtool_ops-\u003eset_link_ksettings(dev, \u0026ksettings);\nnet/ethtool/linkmodes.c-340-\tif (ret \u003c 0) {\n"
} |
| 15/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 50957 output: 28 thoughts: 1192 Thoughts: **Focus Symbol Determination: A Deep Dive** Okay, let's break this down. First, I'm confirming that `lib/bitmap.c` warrants fuzzing based on the changes. It's refactoring and adding new bitwise operations (`__bitmap_and_and`, `__bitmap_and_andnot`) via the `BITMAP_OP` macro. Crucially, these new functions are *added*, not just refactored, which indicates new functionality worth exploring. The touchpoints in core libraries and drivers solidify this. We are also touching both bitmask and linkmode helpers. Next, I'm checking the FocusSymbols guidelines to ensure I don't dilute the fuzzing effort. It's a key consideration. The guidelines tell me to prioritize feature-specific functions and avoid ubiquitous lifecycle functions. I have to avoid functions which are general memory management, synchronization primitives etc. or they will get labeled "focused" when they are not. In this case the changes are mostly in inline helpers. That implies identifying non-static, feature-specific caller functions. So, I've compiled a list of modified symbols: in `lib/bitmap.c` we have `__bitmap_and`, `__bitmap_and_and`, and `__bitmap_and_andnot`. These are exported symbols, meaning they can be called from outside the library. The other changes are in driver functions. Now, let's examine these candidates. While `__bitmap_and` might initially seem ubiquitous, it's only called for multi-word bitmaps or dynamic bit sizes. The new `__bitmap_and_and` and `__bitmap_and_andnot` are definitely *not* ubiquitous; they're the core addition of the patch. The other functions are all specific entrypoints to an ethtool interface, PHY helpers, and USB ethernet drivers. Based on this, the promising focus symbols appear to be `__bitmap_and`, `__bitmap_and_and`, `__bitmap_and_andnot`, `phy_ethtool_ksettings_set`, `genphy_c45_eee_is_active`, `r8152_get_eee` and `r8153_get_eee`. Finally, to make the fuzzing effective, I need to look at Kconfig options. I need to make sure I understand any relevant build dependencies. `lib/bitmap.c` is always built (it's part of the core kernel). The network drivers have dependencies on `CONFIG_PHYLIB`, `CONFIG_USB_RTL8152`, `CONFIG_AMD_XGBE` and `CONFIG_IXGBE`. Now, I'll examine the Kconfig files for `CONFIG_PHYLIB` and `CONFIG_USB_RTL8152` to ensure the fuzzer can be properly configured. |
| 16/2 | 2026/09/08 02:07 | tool | grepper |
0mArgs:{
"Expression": "config PHYLIB",
"PathPrefix": "drivers/net/phy"
}Results: {
"Output": "drivers/net/phy/Kconfig=6=config PHYLINK\n--\ndrivers/net/phy/Kconfig-14-\ndrivers/net/phy/Kconfig:15:menuconfig PHYLIB\ndrivers/net/phy/Kconfig-16-\ttristate \"PHY Device support and infrastructure\"\n--\ndrivers/net/phy/Kconfig=46=config OPEN_ALLIANCE_HELPERS\n--\ndrivers/net/phy/Kconfig-48-\ndrivers/net/phy/Kconfig:49:config PHYLIB_LEDS\ndrivers/net/phy/Kconfig-50-\tdef_bool OF\n"
} |
| 17/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 52944 output: 34 thoughts: 25 Thoughts: Here's a summary of my thought process, as if I were the one thinking it: **Examining USB_RTL8152 in the Kernel Configuration** Okay, I need to get a handle on the `USB_RTL8152` configuration option, likely for a network driver. My first step is to delve into the `drivers/net/usb/Kconfig` file. That's the standard location for USB network device configurations, and `Kconfig` files are where these kernel options are defined and documented. Understanding the dependencies, help text, and default state of this option is crucial before I make any decisions or troubleshoot issues related to the RTL8152 USB ethernet adapter. Time to crack open that Kconfig file and see what we have. |
| 18/2 | 2026/09/08 02:07 | tool | grepper |
0mArgs:{
"Expression": "config USB_RTL8152",
"PathPrefix": "drivers/net/usb"
}Results: {
"Output": "drivers/net/usb/Kconfig=88=config USB_RTL8150\n--\ndrivers/net/usb/Kconfig-98-\ndrivers/net/usb/Kconfig:99:config USB_RTL8152\ndrivers/net/usb/Kconfig-100-\ttristate \"Realtek RTL8152/RTL8153 Based USB Ethernet Adapters\"\n"
} |
| 19/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 53277 output: 35 thoughts: 26 Thoughts: Here's my take on the process, considering my expertise: **Checking `USB_RTL8152` Dependencies** Okay, time to dive into the kernel config and get a handle on the `USB_RTL8152` driver. I need to be absolutely certain I understand its dependencies within the `drivers/net/usb/Kconfig` file. That's the crucial first step. I need to know *exactly* what other options need to be enabled or disabled for this driver to function correctly. I'm thinking about things like `USB_SUPPORT`, naturally, and anything specific to the RTL8152's chipset itself. I also want to double-check any potential conflicts; there shouldn't be any, but a quick scan never hurts, especially given how these configs can get tangled. I'll be looking for relevant `depends on` statements, any `select` directives, and anything that might influence the default settings. It's all about ensuring the configuration is clean, efficient, and avoids any surprises down the line. I want to build a solid foundation and fully understand how this piece fits into the overall network USB driver architecture. |
| 20/2 | 2026/09/08 02:07 | tool | read-file |
0mArgs:{
"File": "drivers/net/usb/Kconfig",
"FirstLine": 95,
"LineCount": 20
}Results: {
"Contents": " 95:\t\n 96:\t\t To compile this driver as a module, choose M here: the\n 97:\t\t module will be called rtl8150.\n 98:\t\n 99:\tconfig USB_RTL8152\n 100:\t\ttristate \"Realtek RTL8152/RTL8153 Based USB Ethernet Adapters\"\n 101:\t\tselect MII\n 102:\t\tselect PHYLIB\n 103:\t\tselect CRC32\n 104:\t\tselect CRYPTO_LIB_SHA256\n 105:\t\thelp\n 106:\t\t This option adds support for Realtek RTL8152 based USB 2.0\n 107:\t\t 10/100 Ethernet adapters and RTL8153 based USB 3.0 10/100/1000\n 108:\t\t Ethernet adapters.\n 109:\t\n 110:\t\t To compile this driver as a module, choose M here: the\n 111:\t\t module will be called r8152.\n 112:\t\n 113:\tconfig USB_LAN78XX\n 114:\t\ttristate \"Microchip LAN78XX Based USB Ethernet Adapters\"\n"
} |
| 21/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 53916 output: 34 thoughts: 38 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Kernel Configuration Hunting** Alright, let's dive into this. My initial instinct is to zero in on the `USB_NET_DRIVERS` or `USB_USBNET` configuration options. I'm suspecting that something related to USB networking is amiss, so these are the obvious targets. To get a comprehensive view, I'm going to navigate to the parent menu within `drivers/net/usb/Kconfig`. That should give me the context I need – the dependencies, other relevant configurations, and hopefully, some clues to pinpoint the precise issue or missing piece. I need to understand the wider scope of the USB networking subsystem within this kernel configuration to fully grasp what's going on. I'll be looking for cross-references, conditional dependencies, and potentially, related device driver configurations. This feels like the right starting point for investigation. |
| 22/2 | 2026/09/08 02:07 | tool | read-file |
0mArgs:{
"File": "drivers/net/usb/Kconfig",
"FirstLine": 1,
"LineCount": 30
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0-only\n 2:\t#\n 3:\t# USB Network devices configuration\n 4:\t#\n 5:\tcomment \"Host-side USB support is needed for USB Network Adapter support\"\n 6:\t\tdepends on !USB \u0026\u0026 NET\n 7:\t\n 8:\tmenuconfig USB_NET_DRIVERS\n 9:\t\ttristate \"USB Network Adapters\"\n 10:\t\tdefault USB if USB\n 11:\t\tdepends on USB \u0026\u0026 NET\n 12:\t\n 13:\tif USB_NET_DRIVERS\n 14:\t\n 15:\tconfig USB_CATC\n 16:\t\ttristate \"USB CATC NetMate-based Ethernet device support\"\n 17:\t\tselect CRC32\n 18:\t\thelp\n 19:\t\t Say Y if you want to use one of the following 10Mbps USB Ethernet\n 20:\t\t device based on the EL1210A chip. Supported devices are:\n 21:\t\t Belkin F5U011\n 22:\t\t Belkin F5U111\n 23:\t\t CATC NetMate\n 24:\t\t CATC NetMate II\n 25:\t\t smartBridges smartNIC\n 26:\t\n 27:\t\t This driver makes the adapter appear as a normal Ethernet interface,\n 28:\t\t typically on eth0, if it is the only ethernet device, or perhaps on\n 29:\t\t eth1, if you have a PCI or ISA ethernet card installed.\n 30:\t\n"
} |
| 23/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 54583 output: 18 thoughts: 46 Thoughts: **Examining the Test Bitmap Configuration** Okay, let's start by getting a handle on this `test_bitmap` configuration. I need to understand its structure, so first, I'll go directly to the source and check what `TEST_BITMAP` is defined as. Is it pointing to a specific test module, or is it referencing something built-in? I'll probably find that information defined within `lib/Kconfig.debug`. That's the logical place to start digging into the details of the configuration system for debugging. Let's see what we've got. |
| 24/2 | 2026/09/08 02:07 | tool | grepper |
0mArgs:{
"Expression": "config TEST_BITMAP"
}Results: {
"Output": "lib/Kconfig.debug=2512=config TEST_KSTRTOX\n--\nlib/Kconfig.debug-2514-\nlib/Kconfig.debug:2515:config TEST_BITMAP\nlib/Kconfig.debug-2516-\ttristate \"Test bitmap_*() family of functions at runtime\"\n"
} |
| 25/2 | 2026/09/08 02:07 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 54862 output: 239 thoughts: 283 Thoughts: **My Assessment of the Patch's Potential** Okay, let's solidify this analysis. First, I need to confirm that everything is as I suspect. It looks like `WorthFuzzing` is set to true, which is encouraging. This patch is touching some pretty fundamental bitmap helpers within `lib/bitmap.c` – specifically `__bitmap_and`, `__bitmap_and_and`, and `__bitmap_and_andnot` – and the associated header `include/linux/bitmap.h`. Beyond that, it also modifies the linkmode helpers in `include/linux/linkmode.h`, as well as some PHY and network driver callers, namely `phy_ethtool_ksettings_set`, `genphy_c45_eee_is_active`, and the `r8152_get_eee` routines. The fact that these helpers are used in core kernel components – networking, cpumask, ethtool, and others – and are accessible through user-space syscalls and emulated devices, really piques my interest. That provides a significant attack surface. Furthermore, I have `EnableConfigs` set to ["PHYLIB", "USB_RTL8152", "TEST_BITMAP"] – all reasonable and expected. And the `FocusSymbols` are clearly defined: `__bitmap_and`, `__bitmap_and_and`, `__bitmap_and_andnot`, `phy_ethtool_ksettings_set`, `genphy_c45_eee_is_active`, `r8152_get_eee`, and `r8153_get_eee`. Now that I've reviewed everything, I'm confident in the assessment. All aspects are well-defined and clearly supported. Time to move forward. |
| 26/2 | 2026/09/08 02:07 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"PHYLIB",
"USB_RTL8152",
"TEST_BITMAP"
],
"FocusSymbols": [
"__bitmap_and",
"__bitmap_and_and",
"__bitmap_and_andnot",
"phy_ethtool_ksettings_set",
"genphy_c45_eee_is_active",
"r8152_get_eee",
"r8153_get_eee"
],
"Reasoning": "The patch refactors the core bitmap AND operations in lib/bitmap.c and introduces new bitmap and linkmode primitives (__bitmap_and_and, __bitmap_and_andnot, bitmap_and_and, linkmode_and, linkmode_and_and, linkmode_and_andnot), along with updating call sites in phylib, network drivers, and USB network drivers. These paths are reachable via standard network/ethtool ioctls, netlink requests, and USB emulation in virtualized fuzzing environments.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"PHYLIB",
"USB_RTL8152",
"TEST_BITMAP"
],
"FocusSymbols": [
"__bitmap_and",
"__bitmap_and_and",
"__bitmap_and_andnot",
"phy_ethtool_ksettings_set",
"genphy_c45_eee_is_active",
"r8152_get_eee",
"r8153_get_eee"
],
"Reasoning": "The patch refactors the core bitmap AND operations in lib/bitmap.c and introduces new bitmap and linkmode primitives (__bitmap_and_and, __bitmap_and_andnot, bitmap_and_and, linkmode_and, linkmode_and_and, linkmode_and_andnot), along with updating call sites in phylib, network drivers, and USB network drivers. These paths are reachable via standard network/ethtool ioctls, netlink requests, and USB emulation in virtualized fuzzing environments.",
"WorthFuzzing": true
} |
| 27/1 | 2026/09/08 02:07 | action | If |
1mArgs:{
"WorthFuzzing": true
}Results: null |
| 28/2 | 2026/09/08 02:07 | agent | kmsan-evaluator |
1mModel:core Args: null Results: {
"KMSANReasoning": "The patch introduces new bitmap helpers (bitmap_and_and, bitmap_and_andnot, linkmode_and_and, linkmode_and_andnot), updates linkmode_and to return a boolean indicating whether the resulting mask is non-empty, and updates various network drivers and PHY library call sites to use these combined helpers.\n\nThese changes strictly perform bitwise operations on existing bitmaps and fully overwrite the destination bitmasks in both small (\u003c BITS_PER_LONG) and multi-word configurations. The patch does not introduce or modify copy-to-user interfaces, uninitialized variable usage, structure padding, or partial initializations. Standard sanitizers (such as KASAN) and unit tests (selftests in lib/test_bitmap.c) are sufficient for validating bounds and bitwise correctness. Therefore, dedicated KMSAN fuzzing is not required.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 2a3ff52999cd9b098395fecb7a7a6cf16ef1b644
Author: syz-cluster <triage@syzkaller.com>
Date: Tue Sep 8 02:06:40 2026 +0000
syz-cluster: applied patch under review
diff --git a/MAINTAINERS b/MAINTAINERS
index 3a19da74d00c9..b78f0bccff545 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4646,6 +4646,7 @@ F: include/linux/cpumask.h
F: include/linux/cpumask_types.h
F: include/linux/find.h
F: include/linux/hw_bitfield.h
+F: include/linux/linkmode.h
F: include/linux/nodemask.h
F: include/linux/nodemask_types.h
F: include/uapi/linux/bits.h
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index a9f4fcc4daae3..113a108559386 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -231,6 +231,7 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
struct xgbe_prv_data *pdata = netdev_priv(netdev);
struct ethtool_link_ksettings *lks = &pdata->phy.lks;
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
+ bool has_advertising;
u32 speed;
int ret;
@@ -267,11 +268,11 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
__ETHTOOL_LINK_MODE_MASK_NBITS, cmd->link_modes.advertising,
__ETHTOOL_LINK_MODE_MASK_NBITS, lks->link_modes.supported);
- linkmode_and(advertising, cmd->link_modes.advertising,
- lks->link_modes.supported);
+ has_advertising = linkmode_and(advertising,
+ cmd->link_modes.advertising,
+ lks->link_modes.supported);
- if ((cmd->base.autoneg == AUTONEG_ENABLE) &&
- bitmap_empty(advertising, __ETHTOOL_LINK_MODE_MASK_NBITS)) {
+ if (!has_advertising && cmd->base.autoneg == AUTONEG_ENABLE) {
netdev_err(netdev,
"unsupported requested advertisement\n");
return -EINVAL;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
index cf881108fa570..5801da6100b8b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
@@ -205,7 +205,6 @@ int hclge_mac_connect_phy(struct hnae3_handle *handle)
struct hclge_dev *hdev = vport->back;
struct net_device *netdev = hdev->vport[0].nic.netdev;
struct phy_device *phydev = hdev->hw.mac.phydev;
- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
int ret;
if (!phydev)
@@ -223,8 +222,8 @@ int hclge_mac_connect_phy(struct hnae3_handle *handle)
return ret;
}
- linkmode_copy(mask, hdev->hw.mac.supported);
- linkmode_and(phydev->supported, phydev->supported, mask);
+ linkmode_and(phydev->supported, phydev->supported,
+ hdev->hw.mac.supported);
linkmode_copy(phydev->advertising, phydev->supported);
/* supported flag is Pause and Asym Pause, but default advertising
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 36e43b5e88d1f..a7b7f89f29e42 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -3751,8 +3751,7 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata)
edata->eee_enabled = !linkmode_empty(edata->advertised);
edata->tx_lpi_enabled = edata->eee_enabled;
- linkmode_and(common, edata->advertised, edata->lp_advertised);
- edata->eee_active = !linkmode_empty(common);
+ edata->eee_active = linkmode_and(common, edata->advertised, edata->lp_advertised);
return 0;
}
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 870920311f9a0..27da1b9ddbc58 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -1623,8 +1623,7 @@ int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *lp)
if (lp)
linkmode_copy(lp, tmp_lp);
- linkmode_and(common, phydev->advertising_eee, tmp_lp);
- if (linkmode_empty(common))
+ if (!linkmode_and(common, phydev->advertising_eee, tmp_lp))
return 0;
return phy_check_valid(phydev->speed, phydev->duplex, common);
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index fce9bc7be3304..cd71186cd8424 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1160,6 +1160,7 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
const struct ethtool_link_ksettings *cmd)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
+ bool has_advertising;
u8 autoneg = cmd->base.autoneg;
u8 duplex = cmd->base.duplex;
u32 speed = cmd->base.speed;
@@ -1167,17 +1168,15 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
if (cmd->base.phy_address != phydev->mdio.addr)
return -EINVAL;
- linkmode_copy(advertising, cmd->link_modes.advertising);
-
/* We make sure that we don't pass unsupported values in to the PHY */
- linkmode_and(advertising, advertising, phydev->supported);
+ has_advertising = linkmode_and(advertising, cmd->link_modes.advertising, phydev->supported);
/* Verify the settings we care about. */
if (autoneg != AUTONEG_ENABLE && autoneg != AUTONEG_DISABLE)
return -EINVAL;
if (autoneg == AUTONEG_ENABLE &&
- (linkmode_empty(advertising) ||
+ (!has_advertising ||
!linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
phydev->supported)))
return -EINVAL;
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 94b2e85e00a37..3430605695c50 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1565,8 +1565,7 @@ static int phy_sfp_module_insert(void *upstream, const struct sfp_eeprom_id *id)
caps = sfp_get_module_caps(phydev->sfp_bus);
- linkmode_and(sfp_support, port->supported, caps->link_modes);
- if (linkmode_empty(sfp_support)) {
+ if (!linkmode_and(sfp_support, port->supported, caps->link_modes)) {
dev_err(&phydev->mdio.dev, "incompatible SFP module inserted, no common linkmode\n");
return -EINVAL;
}
@@ -3761,15 +3760,14 @@ static int phy_probe(struct device *dev)
/* Some PHYs may advertise, by default, not support EEE modes. So,
* we need to clean them. In addition remove all disabled EEE modes.
*/
- linkmode_and(phydev->advertising_eee, phydev->supported_eee,
- phydev->advertising_eee);
- linkmode_andnot(phydev->advertising_eee, phydev->advertising_eee,
- phydev->eee_disabled_modes);
-
/* There is no "enabled" flag. If PHY is advertising, assume it is
* kind of enabled.
*/
- phydev->eee_cfg.eee_enabled = !linkmode_empty(phydev->advertising_eee);
+ phydev->eee_cfg.eee_enabled =
+ linkmode_and_andnot(phydev->advertising_eee,
+ phydev->advertising_eee,
+ phydev->supported_eee,
+ phydev->eee_disabled_modes);
/* Get master/slave strap overrides */
of_set_phy_timing_role(phydev);
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index f61686433031c..75f0574fe1d4a 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -9149,9 +9149,8 @@ static int r8152_get_eee(struct r8152 *tp, struct ethtool_keee *eee)
if (speed & _100bps)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, common);
- linkmode_and(common, common, eee->advertised);
- linkmode_and(common, common, eee->lp_advertised);
- eee->eee_active = !linkmode_empty(common);
+ eee->eee_active = linkmode_and_and(common, common, eee->advertised,
+ eee->lp_advertised);
return 0;
}
@@ -9222,9 +9221,8 @@ static int r8153_get_eee(struct r8152 *tp, struct ethtool_keee *eee)
if (speed & _100bps)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, common);
- linkmode_and(common, common, eee->advertised);
- linkmode_and(common, common, eee->lp_advertised);
- eee->eee_active = !linkmode_empty(common);
+ eee->eee_active = linkmode_and_and(common, common, eee->advertised,
+ eee->lp_advertised);
return 0;
}
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7df1573a409c3..d524ef6b0300b 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -44,6 +44,10 @@ struct device;
* bitmap_fill(dst, nbits) *dst = ~0UL
* bitmap_copy(dst, src, nbits) *dst = *src
* bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2
+ * bitmap_and_and(dst, src1, src2, src3, nbits)
+ * *dst = *src1 & *src2 & *src3
+ * bitmap_and_andnot(dst, src1, src2, src3, nbits)
+ * *dst = *src1 & *src2 & ~(*src3)
* bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2
* bitmap_weighted_or(dst, src1, src2, nbits) *dst = *src1 | *src2. Returns Hamming Weight of dst
* bitmap_weighted_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2. Returns Hamming Weight of dst
@@ -166,6 +170,12 @@ void bitmap_cut(unsigned long *dst, const unsigned long *src,
unsigned int first, unsigned int cut, unsigned int nbits);
bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int nbits);
+bool __bitmap_and_and(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int nbits);
+bool __bitmap_and_andnot(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int nbits);
void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int nbits);
unsigned int __bitmap_weighted_or(unsigned long *dst, const unsigned long *bitmap1,
@@ -337,6 +347,28 @@ bool bitmap_and(unsigned long *dst, const unsigned long *src1,
return __bitmap_and(dst, src1, src2, nbits);
}
+static __always_inline
+bool bitmap_and_and(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, const unsigned long *src3,
+ unsigned int nbits)
+{
+ if (small_const_nbits(nbits))
+ return (*dst = *src1 & *src2 & *src3 &
+ BITMAP_LAST_WORD_MASK(nbits)) != 0;
+ return __bitmap_and_and(dst, src1, src2, src3, nbits);
+}
+
+static __always_inline
+bool bitmap_and_andnot(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, const unsigned long *src3,
+ unsigned int nbits)
+{
+ if (small_const_nbits(nbits))
+ return (*dst = *src1 & *src2 & ~(*src3) &
+ BITMAP_LAST_WORD_MASK(nbits)) != 0;
+ return __bitmap_and_andnot(dst, src1, src2, src3, nbits);
+}
+
static __always_inline
void bitmap_or(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, unsigned int nbits)
diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h
index 3b9de09871f60..efd392dc62ae9 100644
--- a/include/linux/linkmode.h
+++ b/include/linux/linkmode.h
@@ -20,10 +20,27 @@ static inline void linkmode_copy(unsigned long *dst, const unsigned long *src)
bitmap_copy(dst, src, __ETHTOOL_LINK_MODE_MASK_NBITS);
}
-static inline void linkmode_and(unsigned long *dst, const unsigned long *a,
+static inline bool linkmode_and(unsigned long *dst, const unsigned long *a,
const unsigned long *b)
{
- bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ return bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);
+}
+
+static inline bool linkmode_and_and(unsigned long *dst,
+ const unsigned long *a,
+ const unsigned long *b,
+ const unsigned long *c)
+{
+ return bitmap_and_and(dst, a, b, c, __ETHTOOL_LINK_MODE_MASK_NBITS);
+}
+
+static inline bool linkmode_and_andnot(unsigned long *dst,
+ const unsigned long *a,
+ const unsigned long *b,
+ const unsigned long *c)
+{
+ return bitmap_and_andnot(dst, a, b, c,
+ __ETHTOOL_LINK_MODE_MASK_NBITS);
}
static inline void linkmode_or(unsigned long *dst, const unsigned long *a,
diff --git a/lib/bitmap.c b/lib/bitmap.c
index ed685127a1073..85ce3cbaa9ab9 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -34,6 +34,25 @@
* for the best explanations of this ordering.
*/
+/*
+ * Common helper for bitmap operations.
+ * @FETCH: The expression that fetches and combines each word of the bitmaps
+ * @bits: The bitmap size in bits
+ */
+#define BITMAP_OP(FETCH, bits) \
+({ \
+ unsigned long idx, val, sz = (bits), result = 0; \
+ \
+ for (idx = 0; idx * BITS_PER_LONG < sz; idx++) { \
+ val = (FETCH); \
+ if (sz - idx * BITS_PER_LONG < BITS_PER_LONG) \
+ val &= BITMAP_LAST_WORD_MASK(sz); \
+ result |= (dst[idx] = val); \
+ } \
+ \
+ result != 0; \
+})
+
bool __bitmap_equal(const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int bits)
{
@@ -230,19 +249,26 @@ EXPORT_SYMBOL(bitmap_cut);
bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int bits)
{
- unsigned int k;
- unsigned int lim = bits/BITS_PER_LONG;
- unsigned long result = 0;
-
- for (k = 0; k < lim; k++)
- result |= (dst[k] = bitmap1[k] & bitmap2[k]);
- if (bits % BITS_PER_LONG)
- result |= (dst[k] = bitmap1[k] & bitmap2[k] &
- BITMAP_LAST_WORD_MASK(bits));
- return result != 0;
+ return BITMAP_OP(bitmap1[idx] & bitmap2[idx], bits);
}
EXPORT_SYMBOL(__bitmap_and);
+bool __bitmap_and_and(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int bits)
+{
+ return BITMAP_OP(bitmap1[idx] & bitmap2[idx] & bitmap3[idx], bits);
+}
+EXPORT_SYMBOL(__bitmap_and_and);
+
+bool __bitmap_and_andnot(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2,
+ const unsigned long *bitmap3, unsigned int bits)
+{
+ return BITMAP_OP(bitmap1[idx] & bitmap2[idx] & ~bitmap3[idx], bits);
+}
+EXPORT_SYMBOL(__bitmap_and_andnot);
+
void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, unsigned int bits)
{
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 56bd23059b26a..fbc46ed960a4f 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -193,6 +193,81 @@ static void __init test_zero_clear(void)
expect_eq_pbl("", bmap, 1024);
}
+static void __init test_bitmap_and(void)
+{
+ enum { nbits = BITS_PER_LONG + 13 };
+ DECLARE_BITMAP(src1, nbits);
+ DECLARE_BITMAP(src2, nbits);
+ DECLARE_BITMAP(src3, nbits);
+ DECLARE_BITMAP(dst, nbits);
+ DECLARE_BITMAP(expected, nbits);
+ unsigned long small_src1 = ~0UL;
+ unsigned long small_src2 = ~0UL;
+ unsigned long small_src3 = BIT(2);
+ unsigned long small_dst;
+ bool ret;
+
+ ret = bitmap_and_and(&small_dst, &small_src1, &small_src2,
+ &small_src3, 4);
+ expect_eq_ulong(true, ret);
+ expect_eq_ulong(BIT(2), small_dst);
+
+ ret = bitmap_and_andnot(&small_dst, &small_src1, &small_src2,
+ &small_src3, 4);
+ expect_eq_ulong(true, ret);
+ expect_eq_ulong(GENMASK(3, 0) & ~BIT(2), small_dst);
+
+ bitmap_zero(src1, nbits);
+ bitmap_zero(src2, nbits);
+ bitmap_zero(src3, nbits);
+ bitmap_zero(expected, nbits);
+ __set_bit(1, src1);
+ __set_bit(2, src1);
+ __set_bit(BITS_PER_LONG + 1, src1);
+ __set_bit(BITS_PER_LONG + 12, src1);
+ __set_bit(BITS_PER_LONG + 13, src1);
+ __set_bit(1, src2);
+ __set_bit(BITS_PER_LONG + 1, src2);
+ __set_bit(BITS_PER_LONG + 12, src2);
+ __set_bit(BITS_PER_LONG + 13, src2);
+ __set_bit(BITS_PER_LONG + 1, src3);
+ __set_bit(1, expected);
+ __set_bit(BITS_PER_LONG + 1, expected);
+ __set_bit(BITS_PER_LONG + 12, expected);
+
+ ret = bitmap_and(dst, src1, src2, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, dst, nbits);
+ expect_eq_ulong(BIT(1) | BIT(12), dst[1]);
+
+ bitmap_zero(expected, nbits);
+ __set_bit(BITS_PER_LONG + 1, expected);
+ ret = bitmap_and_and(dst, src1, src2, src3, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, dst, nbits);
+ expect_eq_ulong(BIT(1), dst[1]);
+
+ bitmap_zero(expected, nbits);
+ __set_bit(1, expected);
+ __set_bit(2, expected);
+ __set_bit(BITS_PER_LONG + 12, expected);
+ ret = bitmap_andnot(dst, src1, src3, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, dst, nbits);
+ expect_eq_ulong(BIT(12), dst[1]);
+
+ __clear_bit(2, expected);
+ ret = bitmap_and_andnot(src2, src1, src2, src3, nbits);
+ expect_eq_ulong(true, ret);
+ expect_eq_bitmap(expected, src2, nbits);
+ expect_eq_ulong(BIT(12), src2[1]);
+
+ bitmap_fill(src3, nbits);
+ ret = bitmap_and_andnot(src2, src1, src2, src3, nbits);
+ expect_eq_ulong(false, ret);
+ expect_eq_pbl("", src2, nbits);
+}
+
static void __init test_find_nth_bit(void)
{
unsigned long b, bit, cnt = 0;
@@ -1533,6 +1608,8 @@ static void __init test_zero_nbits(void)
bitmap_zero(NULL, 0);
ret = bitmap_and(NULL, NULL, NULL, 0);
+ ret = bitmap_and_and(NULL, NULL, NULL, NULL, 0);
+ ret = bitmap_and_andnot(NULL, NULL, NULL, NULL, 0);
ret = bitmap_empty(NULL, 0);
ret = bitmap_equal(NULL, NULL, 0);
ret = bitmap_full(NULL, 0);
@@ -1566,6 +1643,7 @@ static void __init test_zero_nbits(void)
static void __init selftest(void)
{
test_zero_clear();
+ test_bitmap_and();
test_fill_set();
test_copy();
test_bitmap_region();
|
| 29/3 | 2026/09/08 02:07 | llm | kmsan-evaluator |
1mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 8828 output: 35 thoughts: 1977 Thoughts: **KMSAN Fuzzing Session Assessment** Alright, let's break this down. My task is to determine if this patch warrants a dedicated KMSAN fuzzing session. The core of this patch involves refactoring bitmap operations, specifically related to link mode masks, within the network subsystem. It looks like they're simplifying logic by introducing `_and_and` and `_and_andnot` variants of the existing bitmap functions. The changes target several drivers: AMD Xgbe, Hisilicon HNS3, Intel ixgbe, PHY core and specific PHY drivers, and Realtek r8152/r8153, plus related header and library files. My primary concern is whether these changes could introduce uninitialized memory reads or writes, leading to potential information leaks or crashes. I need to be sure that the new functions correctly handle memory initialization, especially since we're consolidating multiple bitmap operations. I've examined the `BITMAP_OP` macro; it appears to iterate through words of the bitmap, and the loop condition (`idx * BITS_PER_LONG < sz`) is key. The code does seem careful to handle partial words at the end of the bitmap using `BITMAP_LAST_WORD_MASK`. It also handles the edge case where the bit size (`sz`) is a small constant, up to `BITS_PER_LONG` bits, inline. Now, let's check that the use of these new functions doesn't change existing behavior in a way that creates a bug. The code in question passes bitmaps of size `__ETHTOOL_LINK_MODE_MASK_NBITS`. I have reviewed the callers to ensure no new uninitialized memory exposures arise from the introduced functions. Previously, multiple `linkmode_and` calls were used, and the new functions collapse them in a single call. The code appears to fully overwrite the destination bitmap in each case. Critically, existing initialization patterns appear to be unchanged. In all cases, bitmaps are fully overwritten, whether on the stack or in structures, before being used. The test suite in `lib/test_bitmap.c` should also be valuable. Finally, I checked the edge case of `nbits == 0`. The loop in `BITMAP_OP` doesn't execute in that case; the function correctly handles empty bitmaps. However, I need to investigate the kernel's definition of `small_const_nbits`. Based on my analysis, these changes are, in effect, refactoring and optimization. They improve code clarity by collapsing multiple bitmap operations into a single function call, while also simplifying the return logic, but, they do not introduce any obvious uninitialized memory risks. I'm confident that this patch **does not need** a dedicated KMSAN fuzzing session. |
| 30/3 | 2026/09/08 02:08 | tool | grepper |
0mError:no matches Args: {
"Expression": "#define small_const_nbits",
"PathPrefix": "include/linux/bitmap.h"
}Results: {
"error": "no matches"
} |
| 31/3 | 2026/09/08 02:08 | llm | kmsan-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 11438 output: 33 thoughts: 21 Thoughts: Here's my take on those thoughts, tailored for an expert audience: **Examining `small_const_nbits` in linux/bitmap.h** Okay, so I need to refresh my memory on how the kernel handles those smaller bitsets. Let's start with a dive into `include/linux/bitmap.h`. I'm specifically zeroing in on `small_const_nbits`. I want to see how the kernel defines and utilizes this for optimizing bitmap operations when the number of bits is relatively small, because, depending on the architecture and target, that can greatly influence the choice of underlying data structure and the optimization strategies employed in related functions. I need to quickly recall if this is a compile-time constant, a macro, or something dynamically calculated. My guess is it is a compile time constant. This also helps me confirm or reject any prior assumptions I had, especially those related to the tradeoffs between memory usage and performance in small bitmap scenarios. A quick glance should refresh my understanding of where this constant is used and its impact on, for example, the selection of algorithms and the inlining of related functions for improved efficiency. I also want to check for any conditional compilation based on the value of this constant, which could reveal architecture-specific optimizations. |
| 32/3 | 2026/09/08 02:08 | tool | grepper |
0mArgs:{
"Expression": "small_const_nbits",
"PathPrefix": "include/linux/bitmap.h"
}Results: {
"Output": "include/linux/bitmap.h=251=static __always_inline void bitmap_zero(unsigned long *dst, unsigned int nbits)\n--\ninclude/linux/bitmap.h-254-\ninclude/linux/bitmap.h:255:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-256-\t\t*dst = 0;\n--\ninclude/linux/bitmap.h=261=static __always_inline void bitmap_fill(unsigned long *dst, unsigned int nbits)\n--\ninclude/linux/bitmap.h-264-\ninclude/linux/bitmap.h:265:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-266-\t\t*dst = ~0UL;\n--\ninclude/linux/bitmap.h=272=void bitmap_copy(unsigned long *dst, const unsigned long *src, unsigned int nbits)\n--\ninclude/linux/bitmap.h-275-\ninclude/linux/bitmap.h:276:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-277-\t\t*dst = *src;\n--\ninclude/linux/bitmap.h=342=bool bitmap_and(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-344-{\ninclude/linux/bitmap.h:345:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-346-\t\treturn (*dst = *src1 \u0026 *src2 \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ninclude/linux/bitmap.h=351=bool bitmap_and_and(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-354-{\ninclude/linux/bitmap.h:355:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-356-\t\treturn (*dst = *src1 \u0026 *src2 \u0026 *src3 \u0026\n--\ninclude/linux/bitmap.h=362=bool bitmap_and_andnot(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-365-{\ninclude/linux/bitmap.h:366:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-367-\t\treturn (*dst = *src1 \u0026 *src2 \u0026 ~(*src3) \u0026\n--\ninclude/linux/bitmap.h=373=void bitmap_or(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-375-{\ninclude/linux/bitmap.h:376:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-377-\t\t*dst = *src1 | *src2;\n--\ninclude/linux/bitmap.h=383=unsigned int bitmap_weighted_or(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-385-{\ninclude/linux/bitmap.h:386:\tif (small_const_nbits(nbits)) {\ninclude/linux/bitmap.h-387-\t\t*dst = *src1 | *src2;\n--\ninclude/linux/bitmap.h=395=unsigned int bitmap_weighted_xor(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-397-{\ninclude/linux/bitmap.h:398:\tif (small_const_nbits(nbits)) {\ninclude/linux/bitmap.h-399-\t\t*dst = *src1 ^ *src2;\n--\ninclude/linux/bitmap.h=407=void bitmap_xor(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-409-{\ninclude/linux/bitmap.h:410:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-411-\t\t*dst = *src1 ^ *src2;\n--\ninclude/linux/bitmap.h=417=bool bitmap_andnot(unsigned long *dst, const unsigned long *src1,\n--\ninclude/linux/bitmap.h-419-{\ninclude/linux/bitmap.h:420:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-421-\t\treturn (*dst = *src1 \u0026 ~(*src2) \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ninclude/linux/bitmap.h=426=void bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned int nbits)\ninclude/linux/bitmap.h-427-{\ninclude/linux/bitmap.h:428:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-429-\t\t*dst = ~(*src);\n--\ninclude/linux/bitmap.h=442=bool bitmap_equal(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)\ninclude/linux/bitmap.h-443-{\ninclude/linux/bitmap.h:444:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-445-\t\treturn !((*src1 ^ *src2) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=462=bool bitmap_or_equal(const unsigned long *src1, const unsigned long *src2,\n--\ninclude/linux/bitmap.h-464-{\ninclude/linux/bitmap.h:465:\tif (!small_const_nbits(nbits))\ninclude/linux/bitmap.h-466-\t\treturn __bitmap_or_equal(src1, src2, src3, nbits);\n--\ninclude/linux/bitmap.h=472=bool bitmap_intersects(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)\ninclude/linux/bitmap.h-473-{\ninclude/linux/bitmap.h:474:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-475-\t\treturn ((*src1 \u0026 *src2) \u0026 BITMAP_LAST_WORD_MASK(nbits)) != 0;\n--\ninclude/linux/bitmap.h=481=bool bitmap_subset(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)\ninclude/linux/bitmap.h-482-{\ninclude/linux/bitmap.h:483:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-484-\t\treturn ! ((*src1 \u0026 ~(*src2)) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=490=bool bitmap_empty(const unsigned long *src, unsigned nbits)\ninclude/linux/bitmap.h-491-{\ninclude/linux/bitmap.h:492:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-493-\t\treturn ! (*src \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=499=bool bitmap_full(const unsigned long *src, unsigned int nbits)\ninclude/linux/bitmap.h-500-{\ninclude/linux/bitmap.h:501:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-502-\t\treturn ! (~(*src) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=508=unsigned int bitmap_weight(const unsigned long *src, unsigned int nbits)\ninclude/linux/bitmap.h-509-{\ninclude/linux/bitmap.h:510:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-511-\t\treturn hweight_long(*src \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=516=unsigned long bitmap_weight_and(const unsigned long *src1,\n--\ninclude/linux/bitmap.h-518-{\ninclude/linux/bitmap.h:519:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-520-\t\treturn hweight_long(*src1 \u0026 *src2 \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=525=unsigned long bitmap_weight_andnot(const unsigned long *src1,\n--\ninclude/linux/bitmap.h-527-{\ninclude/linux/bitmap.h:528:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-529-\t\treturn hweight_long(*src1 \u0026 ~(*src2) \u0026 BITMAP_LAST_WORD_MASK(nbits));\n--\ninclude/linux/bitmap.h=543=unsigned long bitmap_weight_from(const unsigned long *bitmap,\n--\ninclude/linux/bitmap.h-550-\ninclude/linux/bitmap.h:551:\tif (small_const_nbits(end))\ninclude/linux/bitmap.h-552-\t\treturn hweight_long(*bitmap \u0026 GENMASK(end - 1, start));\n--\ninclude/linux/bitmap.h=566=void bitmap_set(unsigned long *map, unsigned int start, unsigned int nbits)\n--\ninclude/linux/bitmap.h-569-\t\t__set_bit(start, map);\ninclude/linux/bitmap.h:570:\telse if (small_const_nbits(start + nbits))\ninclude/linux/bitmap.h-571-\t\t*map |= GENMASK(start + nbits - 1, start);\n--\ninclude/linux/bitmap.h=582=void bitmap_clear(unsigned long *map, unsigned int start, unsigned int nbits)\n--\ninclude/linux/bitmap.h-585-\t\t__clear_bit(start, map);\ninclude/linux/bitmap.h:586:\telse if (small_const_nbits(start + nbits))\ninclude/linux/bitmap.h-587-\t\t*map \u0026= ~GENMASK(start + nbits - 1, start);\n--\ninclude/linux/bitmap.h=598=void bitmap_shift_right(unsigned long *dst, const unsigned long *src,\n--\ninclude/linux/bitmap.h-600-{\ninclude/linux/bitmap.h:601:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-602-\t\t*dst = (*src \u0026 BITMAP_LAST_WORD_MASK(nbits)) \u003e\u003e shift;\n--\ninclude/linux/bitmap.h=608=void bitmap_shift_left(unsigned long *dst, const unsigned long *src,\n--\ninclude/linux/bitmap.h-610-{\ninclude/linux/bitmap.h:611:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-612-\t\t*dst = (*src \u003c\u003c shift) \u0026 BITMAP_LAST_WORD_MASK(nbits);\n--\ninclude/linux/bitmap.h=618=void bitmap_replace(unsigned long *dst,\n--\ninclude/linux/bitmap.h-623-{\ninclude/linux/bitmap.h:624:\tif (small_const_nbits(nbits))\ninclude/linux/bitmap.h-625-\t\t*dst = (*old \u0026 ~(*mask)) | (*new \u0026 *mask);\n"
} |
| 33/3 | 2026/09/08 02:08 | llm | kmsan-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 14640 output: 205 thoughts: 572 Thoughts: **My Analysis of the Proposed Changes and KMSAN Applicability** Okay, let's break this down. My initial assessment is that these changes are primarily focused on optimization and code clarity within the bitmap and link mode operations across several network drivers and the PHY subsystem. It seems we're adding some new helper functions: `bitmap_and_and`, `bitmap_and_andnot`, `linkmode_and_and`, `linkmode_and_andnot`. We're also tweaking `linkmode_and` to return a boolean indicating a non-empty result. This involves a refactoring of existing code, using a macro (`BITMAP_OP`) to streamline the bitmap operations. Several drivers (xgbe, hclge, ixgbe, phy, r8152) will see their code simplified as a result. Crucially, there are also new tests in `lib/test_bitmap.c`, which is good to see. Now, the critical question: Does this introduce any risks related to KMSAN? My job is to determine if uninitialized memory is exposed, if there are new `copy_to_user` or info leak paths, or if buffer sizes/padding have changed in a way that creates a vulnerability. Let's look at the areas of concern. First, there are no new `copy_to_user` calls or information leak paths. This is a crucial point, and it’s good that it's been explicitly checked. Second, none of the newly introduced data structures are uninitialized. This is also important. I need to make sure the modified bitmaps are either initialized when the driver starts, or fully updated via the provided bitmap operations. This looks good. The boolean return value of the bitmap operations is also a sign that KMSAN-specific uninitialized memory branching is not a problem. Furthermore, any issues in the bitwise logic, or out-of-bounds array reads within bitmaps, are things that will be detected by KASAN or regular test suites. These are not specific to KMSAN. There doesn't appear to be any memory that's uninitialized and at risk of KMSAN-specific problems. Therefore, my conclusion is that `NeedsKMSAN=false`. Here's the rationale I'll prepare for this: The patch introduces new helper functions for bitmap calculations and refactors existing code to take advantage of these and their boolean return values, or combination operators, but does not alter the initialization or write semantics of any of the targeted bitmaps. This change doesn't introduce any new kernel-to-user information leaks and doesn't expose any uninitialized variables. This is a fairly straightforward refactoring, with the changes being well-tested. We have standard sanitizers and KASAN, so a dedicated KMSAN fuzzing session isn't warranted in this case. |
| 34/3 | 2026/09/08 02:08 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch introduces new bitmap helpers (bitmap_and_and, bitmap_and_andnot, linkmode_and_and, linkmode_and_andnot), updates linkmode_and to return a boolean indicating whether the resulting mask is non-empty, and updates various network drivers and PHY library call sites to use these combined helpers.\n\nThese changes strictly perform bitwise operations on existing bitmaps and fully overwrite the destination bitmasks in both small (\u003c BITS_PER_LONG) and multi-word configurations. The patch does not introduce or modify copy-to-user interfaces, uninitialized variable usage, structure padding, or partial initializations. Standard sanitizers (such as KASAN) and unit tests (selftests in lib/test_bitmap.c) are sufficient for validating bounds and bitwise correctness. Therefore, dedicated KMSAN fuzzing is not required.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch introduces new bitmap helpers (bitmap_and_and, bitmap_and_andnot, linkmode_and_and, linkmode_and_andnot), updates linkmode_and to return a boolean indicating whether the resulting mask is non-empty, and updates various network drivers and PHY library call sites to use these combined helpers.\n\nThese changes strictly perform bitwise operations on existing bitmaps and fully overwrite the destination bitmasks in both small (\u003c BITS_PER_LONG) and multi-word configurations. The patch does not introduce or modify copy-to-user interfaces, uninitialized variable usage, structure padding, or partial initializations. Standard sanitizers (such as KASAN) and unit tests (selftests in lib/test_bitmap.c) are sufficient for validating bounds and bitwise correctness. Therefore, dedicated KMSAN fuzzing is not required.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|