From patchwork Sun Sep 20 11:27:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11787471 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 786286CA for ; Sun, 20 Sep 2020 11:28:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57EDB235FA for ; Sun, 20 Sep 2020 11:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600601311; bh=fm7sgvvsHrieUik4TkM1qthsRkZi6ZzJbpsGAr/QaxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CKnL4UmZgPOECP08BQuxLdZjqswx5fB4s3L+aug7qoUs165AF4Cvo3mgPQ4D+EFLP 2BECMgbruWD7zotHYALGdAEChevNSlE+4nS7TriyEmLiZyD3advvWiqTr9zdDfkS6a 9Dbx0TtAqyBcH1pkviccfFy0Tqr094fsh1lp4ruM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726293AbgITL2a (ORCPT ); Sun, 20 Sep 2020 07:28:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:39478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgITL23 (ORCPT ); Sun, 20 Sep 2020 07:28:29 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B53C1221EC; Sun, 20 Sep 2020 11:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600601308; bh=fm7sgvvsHrieUik4TkM1qthsRkZi6ZzJbpsGAr/QaxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A2taVisEOEWaeYEiAbNQCEOtXVPivmsTYGy2FhU5ItM8+mlRdqQSuFeXS9qrHZGP5 c0vR05JLobfQaSpwS2D2Li7rNKLemTXcufh5IYrLQaxwYK90JkUdCM+2hRm0mlBfnq IteUBwHPvjtHoYTa8RAG0muxNzl8iDbJbR0jxjnc= From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Andy Shevchenko , Jonathan Cameron , Daniel Baluta Subject: [PATCH v4 4/8] iio:imu:bmi160: Fix too large a buffer. Date: Sun, 20 Sep 2020 12:27:38 +0100 Message-Id: <20200920112742.170751-5-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200920112742.170751-1-jic23@kernel.org> References: <20200920112742.170751-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron The comment implies this device has 3 sensor types, but it only has an accelerometer and a gyroscope (both 3D). As such the buffer does not need to be as long as stated. Note I've separated this from the following patch which fixes the alignment for passing to iio_push_to_buffers_with_timestamp() as they are different issues even if they affect the same line of code. Signed-off-by: Jonathan Cameron Cc: Daniel Baluta --- v4: New patch drivers/iio/imu/bmi160/bmi160_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c index 222ebb26f013..39fea58dd308 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c @@ -427,8 +427,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct bmi160_data *data = iio_priv(indio_dev); - __le16 buf[16]; - /* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */ + __le16 buf[12]; + /* 2 sens x 3 axis x __le16 + 2 x __le16 pad + 4 x __le16 tstamp */ int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L; __le16 sample;