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=1796220268; b=L3fh1n/biJx5qbU5c7kwoh2iSyNkbkd7uGFSqedXjuilOTpOkw7Xi/MELmGqWMeoyfze Bl/6znMB9zY6r6Tbtz4TmhZ5PxKDq7s6/ZT0tzTwH6jugRXER+RhZTNlY1SLHhvDWc7u4 JBdcnD3RuTY3FGFSyJs9bdv6G1YAlyI3wR2DLlnM93+zMlLXMhf6DD9iAl+LWwIN6Qinu whn/gkgg2fW/QEa+QtehbKHdOt06aCRYIA/6cMgKYBmXgd/QuINvrvndVgDqkCu1CHkeJ 9qSMPNWbiLYcRZ4ndC2XSZtpVw6GXRYNvLRXIFmRyanXyJddmqwOAmZdkMlLJEiRnZg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220268; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=O9FibnglKjTfYBS0gOhuVCscbcUOI2vmMvtLLa+2haA=; b=M5mgWw0oND/RyeARgAg0ZxYFFM2Vpq5qWDlJIKCbekiSp0IAdiW5Bii8JzjYvfNsDmmY jnuI9CShUnyquz/LIr3pV7jQRWkM2dfzmS35C2EU4ny3pjYBW+szPTsdDZAcyQXyJ/Vmj DJZjmydygqN1lxPoEEbMDs1fFnyzsQ+4mR4hyrYPC2XC3wUEjPFWq3P1I2yrIzvVdhG0M 1b2eRPb5VsT/+XcLcEwvE+muMdL8XmqjOnhXyQSq2OG8itv7m49QyXVFdQYsAiUk+XoDh hhCPcCk6+XbGlmqu1yGRFuYdWTs3mNVWJpM3a+oMI/WX2jl87a3ODTrg1/3JCVCHBjw== 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=LsNHKv7R; 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 6C3B8606A31A; Wed, 2 Dec 2026 14:04:28 +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=LsNHKv7R Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AE881F0089A; Wed, 2 Dec 2026 14:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796220267; bh=O9FibnglKjTfYBS0gOhuVCscbcUOI2vmMvtLLa+2haA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=LsNHKv7RQtEjfySkuRrLfbT8je7zwVBr3kmoxDXyCx8jI/mIk7HNLVd+rdoDlf5hR DRJNtiXLiSWzgys9MG4H2AS4Q8h6dHajILr9V0gtq82cFMyqWb5uoEwe2tBTWzHshI bpLWnHqDoOZzGPdeXw2I3FQMqXs7YdNDgU5G7LgPSalFZ+iBzKJ3wyJZfJXfutnb4J ZYPQLaTbwHXOyEgVlgruOLH6JKBMbzftd9Yesk2YZTe0XO0Z5FdZX6+Qe9ufM55ZCg wwcBTXVEov0unIVlAvfUu2ohS56XUBYfUrbTbhnrYFeNvv+OoSfnAvmrTVBkHIzfpb eLMVWJLG5wHpw== Date: Wed, 2 Dec 2026 14:04:23 +0000 From: Lee Jones To: Cong Nguyen Cc: Pavel Machek , Fenglin Wu , Konrad Dybcio , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] leds: flash: qcom-flash: fix the v4l2 flash release loops Message-ID: <20261202140423.GC43081@kernel.org> References: <20261124095408.3842986-1-congnt264@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261124095408.3842986-1-congnt264@gmail.com> On Tue, 24 Nov 2026, Cong Nguyen wrote: > qcom_flash_v4l2_init() stores each LED's v4l2_flash in > v4l2_flash[leds_count], and probe increments leds_count after each LED. > So the valid entries are 0..leds_count - 1. > > The release loops in the probe error path and in remove() start one past > the last stored entry and never reach index 0: > > while (v4l2_flash[leds_count] && leds_count) > v4l2_flash_release(v4l2_flash[leds_count--]); > > After a successful probe of N LEDs, remove() reads index N of an array > with N entries. When probe fails, that entry is NULL, so nothing is > released. > > Release the entries from leds_count - 1 down to 0 instead. > v4l2_flash_release() ignores NULL. > > This issue was found by auditing the driver with an LLM coding assistant. > > Fixes: 96a2e242a5dc ("leds: flash: Add driver to support flash LED module in QCOM PMICs") > Signed-off-by: Cong Nguyen Set does not apply - please rebase onto -next and submit a [RESEND]. -- Lee Jones