From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796287256; b=hQmP/ck6E7i7+3n0eiYNuiVm74d3VYCNTUSx0Ngp7o5sPPh/npxrx0abUhCscbIFCiwN 7fVmW/OtwbxDAEOpdhHY/TyatfH5c/BKTlWaKSOrE2tH9NnV9E6a1zw2EM0eXHVBbKSa+ hJfKtZG8C3h31Evztzw+ul7jkShPjAJHUMNQvKB2lEYiLYl76mDiNCwRT8oWG2RLlHOR1 osuI5j+pHUleFYT1Oc/fI0GZ1h9fR88oAcbTjgIplQ5F63gUbgolA1377TlWD/GJDHK3z AOzeU2B4uK+st2fawinzLF4SmlfBOEhpYQaE78EjnOzUDmwSz2fs8XLlJQDE5LtRI5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796287256; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=OwlY1rfXk8b2a/IVqhSM2JH8LBBL6Cviqg8ZawtVKz4=; b=aKpMl3I82pfJrJMMeHv9hXCQ8vn43S5QkuPJF9oafutkJW1uWmwsBFXSOmcBOM8rTS8N 2ibmYXDQAR5DUPaHylvXaWmeWh8UcJDbiyoNiikdlLGBSy2p3hjdknBTCDuE+XG5+rgmg 1kM4HqhoQ0BAaJEU8UQlzPZ9VJY0z51fR6Uutmme2CvbxVIH9+BkDyaXvpnjbsL09jwA6 Ar6ySpeJ6O5PoGc8GUXewzqfcDe6/MxfM2T5r8YJ9cbUN19AZeVJZgWeVomUrKJyKJzWR 5H5Wx/bf+oHzVZY9ctNeQq19KhjwZu6Ur3FaGxITcX/MmurIm7CY5gewsfdSVcV/bEA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FHQzb3+P; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2366D606A330 for ; Thu, 3 Dec 2026 08:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FHQzb3+P Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF541F00893; Thu, 3 Dec 2026 08:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796287255; bh=OwlY1rfXk8b2a/IVqhSM2JH8LBBL6Cviqg8ZawtVKz4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FHQzb3+PLGIKk9CDFUiSBwDlH0UUpONb0h+vDbUo0Fom1U9rul/7O99+7lxdCO/O1 kX4zs8N6JXniAiaRwSWBLPZTfq2BwM6rwmgU8kLHuaqwvQzb545chgwj+fQJH6iy1k dVDgp5D1J+nUKOb82t3Q7nrhw2QIepStrViI9Huw9c5WFe9/RUAeN0aqeMCD2So1AJ Emvz04xJ6ZQUo0UtYYbdZu/bkfJl16jlvpv9JUrVLb0kLv8VGuNnPb5WWooXkF27NC 8IZ14nlPsIt5zqWrJBWHBrWgjaeafuRiZYzJuyFFcLWCEIcQu5/nnvzyzGwGbuERuK kFC87f/vfKu1w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v18 2/6] net: dsa: motorcomm: use max_ports in series for port bounds checking Reply-To: sashiko-reviews@lists.linux.dev To: "Kyle Switch" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261202084022.3716891-3-kyle.switch@motor-comm.com> References: <20261202084022.3716891-1-kyle.switch@motor-comm.com> <20261202084022.3716891-3-kyle.switch@motor-comm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 08:40:55 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] net: dsa: motorcomm: leak of struct mii_bus in yt921x_mbus_int_init() -- commit 8074bb765350f7aada8a9ccc2903eb46cbd7f38d Author: Kyle Switch net: dsa: motorcomm: use max_ports in series for port bounds checking This commit replaces the hardcoded YT921X_PORT_NUM constant in internal MDIO bus operations and setup with the per-series max_ports field, and validates max_ports before computing mbus->phy_mask. > diff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motor= comm/mdio_bus.c > index a4062e6b0f000..a06e2cc94a3e2 100644 > --- a/drivers/net/dsa/motorcomm/mdio_bus.c > +++ b/drivers/net/dsa/motorcomm/mdio_bus.c [ ... ] > @@ -155,6 +155,7 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, st= ruct device_node *mnp) > { > struct device *dev =3D yt921x_priv_to_device(priv); > struct mii_bus *mbus; > + u32 max_ports; > int res; > =20 > mbus =3D mdiobus_alloc(); > @@ -167,7 +168,12 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, s= truct device_node *mnp) > mbus->read =3D yt921x_mbus_int_read; > mbus->write =3D yt921x_mbus_int_write; > mbus->parent =3D dev; > - mbus->phy_mask =3D (u32)~GENMASK(YT921X_PORT_NUM - 1, 0); > + max_ports =3D priv->series->max_ports; > + if (max_ports =3D=3D 0 || max_ports > ARRAY_SIZE(priv->ports)) { > + dev_err(dev, "Invalid max_ports: %u\n", max_ports); > + return -EINVAL; > + } [Severity: Medium] Does this error path leak mbus? mbus was allocated with mdiobus_alloc() above (not devm_mdiobus_alloc()), so returning -EINVAL without calling mdiobus_free(mbus) or validating max_ports before mdiobus_alloc() leaks the struct mii_bus. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202084022.3716= 891-1-kyle.switch@motor-comm.com?part=3D2