From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 C18EB304BDE for ; Thu, 5 Mar 2026 06:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772692236; cv=none; b=uKoe1+AYIty6L/XoCnTUtg+AXkF8N0gvfWuNKalJ5/CwLZVpwdPlkzT97piZqFg/jhVIjRhl07Fw4NkINiWZDcLj8nt8dyI8oZgwQl9ul7ga+BADMj3tf3PCUI7eeQI2FDwbgSj1g9rnIVI2p9+I2QqXToZwWphPHkkRwEA9qm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772692236; c=relaxed/simple; bh=mHoHdI5w2SuoeJSnbDuo/FCwnRARmmMmQQ9TYO2xQ1E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LB+dP0rREpZDzw/PQ0QOHDHMEj+8e+t7fss6waRHitLjAsJuASB3o1mLKvd+N/hhuhHgBTtsTAswHZnxCA9J5ILH48kEOkn42Dbr41CTi8N449rzHN7whOub4xs02v3UZxcKguN2uzQefOAT7dmBnA2N1y5Gckb9MxBYjTcWD9Q= 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=rCiRs15t; arc=none smtp.client-ip=209.85.128.46 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="rCiRs15t" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-48370174e18so45092975e9.2 for ; Wed, 04 Mar 2026 22:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772692233; x=1773297033; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XnoqO+Dz4YYHuPGEXnm385hs046xHUlElL9Myj9haT4=; b=rCiRs15tHzN8rMcP50jcGYha7Pwc+TcM6egGcSIWJ+8KQ1lnc91JVfpo7BHV1oCc1b mNFVLSKI/pGghTKIVTX4aXv+hEyA6A2/w957X1RETugqosb2L+z/9LhbmnreXF9Kl4ig t26CbYWPTNvDWJsODX8YhsonMSneq55g2oH9WSZguKAWYRjyBiSWeO2hTUTSmAAGoL3J j6YTlolaLDZI779DeBgYI+V8D5S563yaEvemnEGojqsTRngZPkRs13yGF/ap0WrGpAz2 TDXi9iCswWquhHbfc3jZpDWg/Tzu4iGEslnqRLnW8LtlsaatWPgM3qRUoRZ9yLmVbMlZ YyJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772692233; x=1773297033; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XnoqO+Dz4YYHuPGEXnm385hs046xHUlElL9Myj9haT4=; b=sP3stUMlkgfFT+hVnKiqfbrnih4w/rsOx1uJ/JnvOQLc/4YE0MC+gBqOKtzNTGsmNl 7fvhq+9wx2vK0rnmYRqsf9Ah3aF1ELXdkS/afUo0kWC7KMUKDzBl+Jll9xRc+50EtXWH sM3CxYC68RVxEe3mYRRNVSRdrawoT0ulgOCvwJDX1Oxh/JBP5Z69zYtvrHeo81Gf2I6N FepA2me9jRRCvrcrJsH+83xzTuPPTvyea9f4j84w6nVivOsia0WlgZhLMsuyk89HsF4N cqn7rKVpiQchS1yRcgKoLAntZsF60JDcLLyzeS7z34gFWH04ZGL9WlrRA++pexrtANk1 aQmg== X-Forwarded-Encrypted: i=1; AJvYcCXWduHMaXnKWefRrYhRfru/GGqZSVp36mB52F0KFIEaC44njSINUmYZMOLBtAYdtHWfncJb/rjW+bLDsyE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2X8vfXXdtqq77nM05kfA758u0epDc8tktwS1YPmVOUO5HRudV OxDUA+WYSJy/G3eHDh0O8iJHXVUwZsC+9ZodsQbY8HI+8xzCTkZbB5ek77TukaK7vr4= X-Gm-Gg: ATEYQzwKeawIOeK4zI3HLF+iw6XMo4nvlqyJpoZ1PsVJ5XIs1OjHXsY2qVs8P4T6xSc GdiaTMwC2Lkce6MT3ssb3TGwEY7wzkj9IR22FijQueZ1oYtVP4XiOMDbCfadeInVg5cXjchG+2G +vyBO95eZh559MzCOilxfDh7rgCARBzCQmm5tlSH8DEl5q/Bvugu7Twm/TbDwZ5SDEeblYGGdUD ZR9Ys3r/KPVdCUqjdZyJaiG5/dvSTWOeauwa3PGJUZ+LHMRRbrbaZ9xuaGld1aBXVtAJJvwAqGm /fD13it++sOnmQjxBixFUjYNw5mw9ze+7c4mNH1jql6mHmWoSmG2rgxyowxd388hVC5Yvso5FyZ lGewlwd9eYaAqfsb7UGuLvyBpKhmrplXyyaN85qm7ZTKkgvCvAOYP6EVZ11u1u04mxGnlLhZLDe Nb9xQhq0cM8kZ9+rmzqHUtozVPBcs8 X-Received: by 2002:a05:600c:a087:b0:483:badb:618b with SMTP id 5b1f17b1804b1-4851988467amr74748955e9.24.1772692233099; Wed, 04 Mar 2026 22:30:33 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851a82dac3sm61667235e9.0.2026.03.04.22.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 22:30:32 -0800 (PST) Date: Thu, 5 Mar 2026 09:30:29 +0300 From: Dan Carpenter To: Alexandru Hossu Cc: parthiban.veerasooran@microchip.com, christian.gromm@microchip.com, gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: most: video: fix read() length underflow Message-ID: References: <20260305015703.41762-1-hossu.alexandru@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260305015703.41762-1-hossu.alexandru@gmail.com> On Thu, Mar 05, 2026 at 02:57:03AM +0100, Alexandru Hossu wrote: > Avoid unsigned underflow when fh->offs exceeds mbo->processed_length. > Use size_t for length calculations and clamp invalid offsets. > > Signed-off-by: Alexandru Hossu > --- No, this patch isn't correct or required. Look at how fh->offs is set. It can't be more than processed_length. I was worried there might be a race condition but that is prevented by the: if (!atomic_inc_and_test(&mdev->access_ref)) { which prevents multiple concurrent readers. The other thing is that "count" can't be more than MAX_RW_COUNT so ret is fine as an int. (Also it can't be more than processed_length which is at most U16_MAX.) With this kind of change I would want the commit message to have an explanation of all the variables and the list of functions where they are set. That shows you have done the analysis and it speeds up my analysis as well as a reviewer. regards, dan carpenter