diff options
author | David S. Miller <davem@davemloft.net> | 2025-03-19 09:57:37 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2025-03-19 09:57:37 +0000 |
commit | d9c743b6990b1ee3925f3ced1844cafa955bacb0 (patch) | |
tree | 730c91319266d5994452fcbf31590f3661acf348 | |
parent | 9a81fc3480bf5dbe2bf80e278c440770f6ba2692 (diff) | |
parent | 3178d2b048365fe2c078cd53f85f2abf1487733b (diff) |
Merge branch 'xa_alloc_cyclic-checks'
Michal Swiatkowski says:
====================
fix xa_alloc_cyclic() return checks
Pierre Riteau <pierre@stackhpc.com> found suspicious handling an error
from xa_alloc_cyclic() in scheduler code [1]. The same is done in few
other places.
v1 --> v2: [2]
* add fixes tags
* fix also the same usage in dpll and phy
[1] https://lore.kernel.org/netdev/20250213223610.320278-1-pierre@stackhpc.com/
[2] https://lore.kernel.org/netdev/20250214132453.4108-1-michal.swiatkowski@linux.intel.com/
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/dpll/dpll_core.c | 2 | ||||
-rw-r--r-- | drivers/net/phy/phy_link_topology.c | 2 | ||||
-rw-r--r-- | net/devlink/core.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index 32019dc33cca..1877201d1aa9 100644 --- a/drivers/dpll/dpll_core.c +++ b/drivers/dpll/dpll_core.c @@ -505,7 +505,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, xa_init_flags(&pin->parent_refs, XA_FLAGS_ALLOC); ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b, &dpll_pin_xa_id, GFP_KERNEL); - if (ret) + if (ret < 0) goto err_xa_alloc; return pin; err_xa_alloc: diff --git a/drivers/net/phy/phy_link_topology.c b/drivers/net/phy/phy_link_topology.c index 4a5d73002a1a..0e9e987f37dd 100644 --- a/drivers/net/phy/phy_link_topology.c +++ b/drivers/net/phy/phy_link_topology.c @@ -73,7 +73,7 @@ int phy_link_topo_add_phy(struct net_device *dev, xa_limit_32b, &topo->next_phy_index, GFP_KERNEL); - if (ret) + if (ret < 0) goto err; return 0; diff --git a/net/devlink/core.c b/net/devlink/core.c index f49cd83f1955..7203c39532fc 100644 --- a/net/devlink/core.c +++ b/net/devlink/core.c @@ -117,7 +117,7 @@ static struct devlink_rel *devlink_rel_alloc(void) err = xa_alloc_cyclic(&devlink_rels, &rel->index, rel, xa_limit_32b, &next, GFP_KERNEL); - if (err) { + if (err < 0) { kfree(rel); return ERR_PTR(err); } |