From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4A211F91F6; Mon, 23 Mar 2026 14:22:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275745; cv=none; b=CWAtlBxNIx/+LpirS0iySbuAHikz2lXNvxPdECuH/wjrFC/M5lVltCm/BtCdAVAROUDiWHWpKkpaToeCB4HcFKMJexttbuvVq+I4pIfUkY36oPyCfCQEx9JgVXYxpFfwDI6JY1axjXKjdhtPvnJ6klfDsgTJ18Utb66xBUf2wJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275745; c=relaxed/simple; bh=hlqscGFKnPw5oiloxWoTTdBSLU/AN2qRT52kp+bQpSc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KCp++YE5SF7qPwo5IljzMC8K0hRCLswrqekPVlsrBHodd9G1VstNnBaj5aymtocUCFv0pURIXHNDoB2IPoJiV2KKIXkK1Xx1+qGWu8BK7LNNAYJrD95lFyRUWS0DXcJ3cc2yPI/lthaSJ+zz8mpJngD/4aGF6yDy6fiw66S/RYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tebfytEa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tebfytEa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D771C4CEF7; Mon, 23 Mar 2026 14:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774275745; bh=hlqscGFKnPw5oiloxWoTTdBSLU/AN2qRT52kp+bQpSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tebfytEaDaxW3es79zNpcjNRWY+F4EmLn5ga8zjAqRMx1L0ALk0E9BVpZdDwy8f9Y vaaWZ1fYjL9pqD55emIAvnjWj+U69TVBvCSwhCL87qTnb97NaVkDni5sbU0HWPLApl SqhFiaH+VJpvK/AjvWCkT18bhy/y+Vu/H2wJAY3c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Antoniu Miclaus , Tomasz Duszynski , Andy Shevchenko , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 6.12 205/460] iio: chemical: sps30_serial: fix buffer size in sps30_serial_read_meas() Date: Mon, 23 Mar 2026 14:43:21 +0100 Message-ID: <20260323134531.568005326@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134526.647552166@linuxfoundation.org> References: <20260323134526.647552166@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Antoniu Miclaus commit c3914ce1963c4db25e186112c90fa5d2361e9e0a upstream. sizeof(num) evaluates to sizeof(size_t) which is 8 bytes on 64-bit, but the buffer elements are only 4 bytes. The same function already uses sizeof(*meas) on line 312, making the mismatch evident. Use sizeof(*meas) consistently. Fixes: b2e171f5a5c6 ("iio: sps30: add support for serial interface") Signed-off-by: Antoniu Miclaus Acked-by: Tomasz Duszynski Reviewed-by: Andy Shevchenko Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/chemical/sps30_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/chemical/sps30_serial.c +++ b/drivers/iio/chemical/sps30_serial.c @@ -303,7 +303,7 @@ static int sps30_serial_read_meas(struct if (msleep_interruptible(1000)) return -EINTR; - ret = sps30_serial_command(state, SPS30_SERIAL_READ_MEAS, NULL, 0, meas, num * sizeof(num)); + ret = sps30_serial_command(state, SPS30_SERIAL_READ_MEAS, NULL, 0, meas, num * sizeof(*meas)); if (ret < 0) return ret; /* if measurements aren't ready sensor returns empty frame */