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 71DF93B47E8; Mon, 23 Mar 2026 15:09:47 +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=1774278587; cv=none; b=EZMSH2639oPCo33f4ySS4+bTNK3tVtu0pi4Qvt7CjHnaVjRs+Aw7v3piWLLtZxP++BVQjLhnhiQ9ZS5GhT2RJiVNNCXXVV7hPJQTWPT4JKRFOcIkKRoP0AEexZ0pp2wSgAp4mrD/bFbL6EXIf0a9St4/y/Rm9ePlHdX8VIMxtOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774278587; c=relaxed/simple; bh=qps0LLEhSBc8IT+zgVuHkfUwL2Pkr8eGeFDYIrduRvI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m1I97Trb8wpvgRF3wjdOxVJqesTho4mOJlrUqioJRyBn/Exz3mmpGRp/6TjTL/h1Xy1bzkkD5L2kwZ+KcEEc9y7jSPOv/nI/TXy91uYZDzJxFyF1h01ILVvIqv4kPFZ439dbOJibdZ4G56+XqtFZnnwLzbMbMev+lq2XrJNJ3cQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yOUtHTrP; 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="yOUtHTrP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E717BC4CEF7; Mon, 23 Mar 2026 15:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774278587; bh=qps0LLEhSBc8IT+zgVuHkfUwL2Pkr8eGeFDYIrduRvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOUtHTrPpRjod4OIUu4FcolgxQbFLOzLolA82Tx97yKgTD2ZEa8w6MTS2+UWAq8ac vsj5rOJfnJJ3/4JeyVxQG9lrhLsEQncXGUsrKuoiZh9cbrWFwUvpVZsUzc3jnSXI0R nrJ51GJd0ugf3KKjoxWuvlEfPe2vkBlyFVcvwFtw= 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.6 354/567] iio: chemical: sps30_serial: fix buffer size in sps30_serial_read_meas() Date: Mon, 23 Mar 2026 14:44:34 +0100 Message-ID: <20260323134542.593759352@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134533.749096647@linuxfoundation.org> References: <20260323134533.749096647@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.6-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 */