From nobody Fri Dec 19 08:23:01 2025 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FD43158857 for ; Tue, 9 Dec 2025 06:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765263225; cv=none; b=sWiNn8v5WOeWFYlNIMGPtrWzqpPDAhEEci57EhnNO+NREFxo5JEkE8aw13U6d+zRfRCukxXuoRL2wkTsTxtv9O7VyKTvd3ROWhm8y50pDdFsulVfOpNW0K8+u4REa0C6cpaGCqBEFjAHESjvSr1Rhn+TXbokDPtu9+h72iHN2Ng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765263225; c=relaxed/simple; bh=RQdSipf+jBAPbiSIsJI0pwPZWKZWFVvk+g5Ue5AgVgA=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=CUsOipCYNUtIJJtZWsdTckyubbzXkYfwSKDTdsYg+Ux3xjk4poWmpXH4tmS2Dy6OghUuRdJWMqazRB+u6J91h1AKCgsMkClBDiAttY9rrM9ayHOQZxMfcqOkwFBL/IXVfd+hKHYvBBMesVusFSjPcfgu6NfHTBRTzQhSx7r8FWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ut3G1IEw; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ut3G1IEw" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-47796a837c7so46104325e9.0 for ; Mon, 08 Dec 2025 22:53:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765263221; x=1765868021; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=qpimlZdEDtuP7WR2mZA0+z1H7nFjtx/bFty3v8hsXUU=; b=ut3G1IEwoFQpjkDL6t56ZC3IYdP5GI9p3Qs2ct0o4kRKj0H6iMf50VTzOd6Mda8Kbk 28/3rPgVMBLL6nRcL6crtqvHwDLKlnMGCdfKe+3lVzgPaoHIFWODkNi3jVJ9lOqMCBSD gvhXBRzlH5rA59SxDb1vtAqOhzjrBAHiX8ztPUl5rSOe3lkkpv9nUuNndolkI+WHcJw0 Gv/L1VXYgy5p/OHWTIjkc1usb6zColsQACj+yoyQTnYTxxfVOleWx/7Blr/r+8MzvLak ho/h0fjYhPe+/Q3YVyGqQEUUoROi/e/csIk9xNCkQRGD1NYKQCFvCk2W/3N1tMhqqvqS bW7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765263221; x=1765868021; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qpimlZdEDtuP7WR2mZA0+z1H7nFjtx/bFty3v8hsXUU=; b=WdMNLcp2RD/ZEEVZVFHcKMIUr3Aw3tqVR+lMJaniIXiLX5G08XCaKyVq9Km0RLE0cG 5FjZZvx8feKHGQ8T3HeMsiOSW2hY41l888hWJDd0ErYGhF0xLuFwdck4xW7kllyQWkwz VA06Uk2xkyJ9zGUtu7QvLumhKVIONo1S2kWfUvvh9hyowWN+QbmDZ8J8oJjF9YgJ4vPV dr3UNul2J8uj8KrY9M61RWIcC9LgKr06Itkmr0ANlV8aBDabCYoP5lYnCoTF5IkOzdbl EcTed5SbZHni2jZ3FAqOgehWGOgx3Bsdj30kCy+QVOvEHwjPwcPL1nnV1PNdBWfisYub TrvA== X-Forwarded-Encrypted: i=1; AJvYcCXI9KKp85c751UhrFYz4+hKFT1yyjYAZXL8re7ypKPJoJ3eTKdD/O4U8sboUtrPxf/jpvRBQDxf6ihn3FY=@vger.kernel.org X-Gm-Message-State: AOJu0YzUAFBpjghPV4DEnrREDUSIlLHZzmYu61jUkiAjIGdzzB4CQ1Wq 3qrtbRVz4E7BTdUr4oNldtiGktZpwduSHBp0/pAcGSt51y580IkYYT89ZW+XlOWc3ePpDNZ4J70 PxPwA X-Gm-Gg: ASbGncuVBCJnHVXHLWGRWmxsW5FXFBRLXzzn0G8ovwRb4heHjwYymnjjb1bRV9wrBcD RmNl0mc2icYKMqT/i58surPPLSnFHtlvfW2k7TCiKlT/8ielTfOejSD6Dc7MZJb54TaEv8nwD7D DlwN/sjZi4mBimk64ssUd4jg20vIt9vJrTZbczuF60paHX0Th2U0/5Ud6Av0zokwwPhHQPnb9Ns hdFIPblimER289HR9S8UH/G4gFSkGmRePw0tR0nXnMD7klrxqaudJZqxuqKn5QUc6FP3LrYyM+o Zqt5Zf2ggErXUw66LyYitb5bgCK7Ha0zX8ZFXnPNoCBN9a+Hx0nNwczQL5UN/ZGlta4ATssDg/t zsG3zgMNttQ87f2ceX20gPgb50208O4DkZN4iJ7X5/DV04SS5f1wYbR21O/beVC+K86ibRUgaZp aCz5WfDbkYfff6wJiK X-Google-Smtp-Source: AGHT+IGaTnV6DUM6NZ8B996sUpARBrir70sGaGW5NyYdRK9/TvpgGM9K+ozidhKmYpB4+XkFZ3zK7g== X-Received: by 2002:a05:600c:1990:b0:477:73e9:dbe7 with SMTP id 5b1f17b1804b1-47939e4d013mr112666895e9.35.1765263220857; Mon, 08 Dec 2025 22:53:40 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a7d35713asm11916255e9.1.2025.12.08.22.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Dec 2025 22:53:40 -0800 (PST) Date: Tue, 9 Dec 2025 09:53:36 +0300 From: Dan Carpenter To: Amelie Delaunay Cc: Vinod Koul , Neil Armstrong , Maxime Coquelin , Alexandre Torgue , Johan Hovold , Fengguang Wu , Kishon Vijay Abraham I , linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] phy: stm32-usphyc: Fix off by one in probe() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The "index" variable is used as an index into the usbphyc->phys[] array which has usbphyc->nphys elements. So if it is equal to usbphyc->nphys then it is one element out of bounds. The "index" comes from the device tree so it's data that we trust and it's unlikely to be wrong, however it's obviously still worth fixing the bug. Change the > to >=3D. Fixes: 94c358da3a05 ("phy: stm32: add support for STM32 USB PHY Controller = (USBPHYC)") Signed-off-by: Dan Carpenter Reviewed-by: Amelie Delaunay --- drivers/phy/st/phy-stm32-usbphyc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-= usbphyc.c index 27fe92f73f33..b44afbff8616 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -712,7 +712,7 @@ static int stm32_usbphyc_probe(struct platform_device *= pdev) } =20 ret =3D of_property_read_u32(child, "reg", &index); - if (ret || index > usbphyc->nphys) { + if (ret || index >=3D usbphyc->nphys) { dev_err(&phy->dev, "invalid reg property: %d\n", ret); if (!ret) ret =3D -EINVAL; --=20 2.51.0