From patchwork Sat May 1 17:13:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6DC0C433B4 for ; Sat, 1 May 2021 17:15:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A45046157F for ; Sat, 1 May 2021 17:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231335AbhEARQP (ORCPT ); Sat, 1 May 2021 13:16:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:53932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQO (ORCPT ); Sat, 1 May 2021 13:16:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF0EC61574; Sat, 1 May 2021 17:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889324; bh=+LN4Xjdak2iQoEH+UFUsB0pSejQX9aDLtcUaG++5ILI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u32M8JpzKLiq0JX/MuH5znb8K98PloF+PGNZ2HHtSp9tKENc8ttDV3sVdN5+Q2jxT GaIJc7G6rNpD8G5glQyw3mjEXgauZNgn2xr3zoivXI5UXZtLueItZslzjbMsgg+z1P AxNsHxcQIZvh01meK+j6JHfmvJ/jsn4ha/nU9lSfiSRF5sKAy+6EU4CnEybHv6Zz8y 144+ZBceX8SilmPdwIp5IHMmdcRv3O37Y58CrqAt2QpUJW8r7EzA8L2FQxFjx2i6XN jHMAyrhkjkZemQZyfZm3z0+csnFlIPOOpKq5RLsm29uNx2nMljWOAMO1AGuKUGH5j/ S6vJ5qDjpbJgg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Eugen Hristev Subject: [PATCH 01/11] iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:42 +0100 Message-Id: <20210501171352.512953-2-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned. Found during an audit of all calls of this function. Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support") Signed-off-by: Jonathan Cameron Cc: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index a7826f097b95..d356b515df09 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -403,7 +403,8 @@ struct at91_adc_state { struct at91_adc_dma dma_st; struct at91_adc_touch touch_st; struct iio_dev *indio_dev; - u16 buffer[AT91_BUFFER_MAX_HWORDS]; + /* Ensure naturally aligned timestamp */ + u16 buffer[AT91_BUFFER_MAX_HWORDS] __aligned(8); /* * lock to prevent concurrent 'single conversion' requests through * sysfs. From patchwork Sat May 1 17:13:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24187C433B4 for ; Sat, 1 May 2021 17:15:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02B12615FF for ; Sat, 1 May 2021 17:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231342AbhEARQQ (ORCPT ); Sat, 1 May 2021 13:16:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:53952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQQ (ORCPT ); Sat, 1 May 2021 13:16:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D9F26157E; Sat, 1 May 2021 17:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889326; bh=G/aARWL/UXZKE07O8rgezZHf4+23LQMuKHdE+YetCGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrbiNsSw3uxuGQbRzvy4+gf1uET8tmIj/bPiJAY3LK928H3V+xDLO+5oSCBxD6vxl vPrGk9g0tq5Q/ve3bZVdOLAUOL3J0qTWE+552ZL2f+dTtUSeu/QJKbWMRQmIGUurMM 3cIvwdHesWOonCU32djFObtLRlRqGMJlpCBvMA3r3GhB3cStb0ef9WiSOKDP/pEk/+ QaVxqF3HcfdpVVETJ26co1bhDb6mIc0wOYxYYZPh4vp96Yt01tAt8JPkdTMz8zcVLX k/b33BCFnKFP+cX4e8K1hXRtDAfDCeIOGNR0YlVKkITDHsiWEfbWtLGlP3EOTj6wR6 /KtEbCaDPinRA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Andreas Klinger Subject: [PATCH 02/11] iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:43 +0100 Message-Id: <20210501171352.512953-3-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned. Found during an audit of all calls of this function. Fixes: d3bf60450d47 ("iio: hx711: add triggered buffer support") Signed-off-by: Jonathan Cameron Cc: Andreas Klinger --- drivers/iio/adc/hx711.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c index 6a173531d355..f7ee856a6b8b 100644 --- a/drivers/iio/adc/hx711.c +++ b/drivers/iio/adc/hx711.c @@ -86,9 +86,9 @@ struct hx711_data { struct mutex lock; /* * triggered buffer - * 2x32-bit channel + 64-bit timestamp + * 2x32-bit channel + 64-bit naturally aligned timestamp */ - u32 buffer[4]; + u32 buffer[4] __aligned(8); /* * delay after a rising edge on SCK until the data is ready DOUT * this is dependent on the hx711 where the datasheet tells a From patchwork Sat May 1 17:13:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69F5CC43460 for ; Sat, 1 May 2021 17:15:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44225615FF for ; Sat, 1 May 2021 17:15:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231415AbhEARQT (ORCPT ); Sat, 1 May 2021 13:16:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQS (ORCPT ); Sat, 1 May 2021 13:16:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E3E2614A7; Sat, 1 May 2021 17:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889328; bh=nEu9A1pI3R9ee81srm640DsOiOYvfIRSQLBr1IuR9cU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OJc6OmP88Lj9kdMARG33E5XI7eHDdIMTwdyWfCecjABBs3ya7jbAzy34NIR7evt0A /bb5/qYdvRiPpA5qMUsRiqMhPZA3nfFo4unp37xma4jt0gluCDgpeKf1+vKC1DF/Hl k5hyh3dyHIVv2rQl64LUl414tk6G6FF9fRuJQZWoxBE0kKGqPFCJovLWB6wDqf3qWF Y++j3GBh7nCnNCHv9elWxtgRybnbmyxDV7DZyMFxWPE2+7LHT+2Q00mQcNFx2FOGP7 wi0hiX1q/glCwEeckKPuQ8ZmyMfcxy/KJasvh1VBopGvholJUz/xRrM3gdrBWoYj8n oEZtdy6Ujrg3Q== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Andreas Klinger Subject: [PATCH 03/11] iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:44 +0100 Message-Id: <20210501171352.512953-4-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned. Add a comment on why the buffer is the size it is as not immediately obvious. Found during an audit of all calls of this function. Fixes: 6dd112b9f85e ("iio: adc: mxs-lradc: Add support for ADC driver") Signed-off-by: Jonathan Cameron Cc: Andreas Klinger --- drivers/iio/adc/mxs-lradc-adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c index 30e29f44ebd2..c480cb489c1a 100644 --- a/drivers/iio/adc/mxs-lradc-adc.c +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -115,7 +115,8 @@ struct mxs_lradc_adc { struct device *dev; void __iomem *base; - u32 buffer[10]; + /* Maximum of 8 channels + 8 byte ts */ + u32 buffer[10] __aligned(8); struct iio_trigger *trig; struct completion completion; spinlock_t lock; From patchwork Sat May 1 17:13:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE1F5C433ED for ; Sat, 1 May 2021 17:15:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC5DC615FF for ; Sat, 1 May 2021 17:15:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbhEARQU (ORCPT ); Sat, 1 May 2021 13:16:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:54028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQU (ORCPT ); Sat, 1 May 2021 13:16:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 19EBE61494; Sat, 1 May 2021 17:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889330; bh=S+7jWLb5LIxVBBvY3tBtVQzAg9iKURjYg0z5EMqXyb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTrGBzggak5R7TkQ8CwiMcFPrtKNHAKFWMpdW7HBQQ/ACGqtZB1u7urWe/zyhLOPk ZvHPlB0uTrUSfUzO8e8XfBiW8njw5uVR0cB8hNxBfP+rAkh1LC5MuC/mCLOPGu3j83 T81myx3E3NIY0NWKqf6kGVTz6zG/9OYzTLKxTz/sy+L31jYx1wK7++gMz95bE7ktDK 2wDytyh1ql327j38RLizmGGRp25pr/M4hMCnoTMUAnBdxlskgCx1cs8z6GlF3OC2jT s9lT0XZjjPbMHmDAmLO0GpOIPXmGeRrSdIsEFW7HCwHhd/QE0Tx7ocOTCvPi+/I8aT hKhtF9f9In7jw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron Subject: [PATCH 04/11] iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:45 +0100 Message-Id: <20210501171352.512953-5-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted. Fixes: f214ff521fb1 ("iio: ti-ads8688: Update buffer allocation for timestamps") Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ti-ads8688.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index 16bcb37eebb7..79c803537dc4 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c @@ -383,7 +383,8 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) { struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; - u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; + /* Ensure naturally aligned timestamp */ + u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)] __aligned(8); int i, j = 0; for (i = 0; i < indio_dev->masklength; i++) { From patchwork Sat May 1 17:13:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B388BC433B4 for ; Sat, 1 May 2021 17:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8BD7B614A7 for ; Sat, 1 May 2021 17:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231426AbhEARQW (ORCPT ); Sat, 1 May 2021 13:16:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:54048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQV (ORCPT ); Sat, 1 May 2021 13:16:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B52A61606; Sat, 1 May 2021 17:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889331; bh=KvP2G+zbo2Jhbu7xynUgrJA23NE6FxeyqETBqh+9DYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3AgqDCXqpdv+RWS1+Z+ecV0900ZxXpuyZHH1uvVBU+axLHTmZtRjjVG/Liu5p8LH VQ6VcAeZFt9xSuQL51jjIlIorQeCxOMBpKaJmQ3oN9rsqBgG8p80G2ocpuV3CEHgvk Uw1xa9iayxN3mE5AgEijjPe6/X+qfhAAlWMxhzDeOaalKZ1jnYtUlt0L5qGYIkLncL pcMZ6YLbjUl5hZBewXmycF6CrzGE9Jh8ZkkeskCZ1887U3h8p6s3LURGDnZS+LguUM /iizG2sU3Xas4tEwwf+YwZmQoV6KgIc31tgjepvffKhbzuHUhDURydQU88s45Qt+mC VlLVSiZkhb5dA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Matt Ranostay Subject: [PATCH 05/11] iio: chemical: atlas: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:46 +0100 Message-Id: <20210501171352.512953-6-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Variable location for the timestamp, so just use __aligned(8) to ensure it is always possible to naturally align it. Found during an audit of all calls of uses of iio_push_to_buffers_with_timestamp() Fixes tag is not accurate, but it will need manual backporting beyond that point if anyone cares. Fixes: 0d15190f53b4 ("iio: chemical: atlas-ph-sensor: rename atlas-ph-sensor to atlas-sensor") Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Acked-by: Matt Ranostay --- drivers/iio/chemical/atlas-sensor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 56ba6c82b501..6795722c68b2 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -91,8 +91,8 @@ struct atlas_data { struct regmap *regmap; struct irq_work work; unsigned int interrupt_enabled; - - __be32 buffer[6]; /* 96-bit data + 32-bit pad + 64-bit timestamp */ + /* 96-bit data + 32-bit pad + 64-bit timestamp */ + __be32 buffer[6] __aligned(8); }; static const struct regmap_config atlas_regmap_config = { From patchwork Sat May 1 17:13:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F82AC433ED for ; Sat, 1 May 2021 17:15:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36AAC6157E for ; Sat, 1 May 2021 17:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbhEARQX (ORCPT ); Sat, 1 May 2021 13:16:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:54070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQX (ORCPT ); Sat, 1 May 2021 13:16:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 127D761284; Sat, 1 May 2021 17:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889333; bh=2nyzGl1dLGqNduo1q2W6IN09V0foDNM3moAfWVlppr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NcZvsA3hTFyTOwm/0d6bZlSuyOeno/EwxI1bp47l8Qun06cN303egEhmEyFpe+Aeh Kv1+HzIWOr3KUvwic5VphAI/Hct5BCRFb6jBdgggevOoJVG4f8g2ZJlhxuSJOc/jeg Lh+FtR5H8XPo+s3ISfl9gYbsHX0wCs5wviw4mPxUimhyD2UEQLFXUhMr63QW8BLQB8 /mUyjWw+EsHqJK1sQx/Yz1jXQrkDhJRALpoEw2Y5dTBkosyawiQcHUihhUUtg1azx9 wDajS4Ml8xYtZes6gi+WHMIExrsctt4YrcuBNj6xNugDwQyocTNkr8rcbf9yV4TTQJ 5LoB7gRpgcTmg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Gwendal Grignou Subject: [PATCH 06/11] iio: cros_ec_sensors: Fix alignment of buffer in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:47 +0100 Message-Id: <20210501171352.512953-7-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron The samples buffer is passed to iio_push_to_buffers_with_timestamp() which requires a buffer aligned to 8 bytes as it is assumed that the timestamp will be naturally aligned if present. Fixes tag is inaccurate but prior to that likely manual backporting needed. Fixes: 5a0b8cb46624c ("iio: cros_ec: Move cros_ec_sensors_core.h in /include") Signed-off-by: Jonathan Cameron Cc: Gwendal Grignou Reviewed-by: Gwendal Grignou X-Patchwork-Id: 12234923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63A3AC433B4 for ; Sat, 1 May 2021 17:15:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 446BC6157E for ; Sat, 1 May 2021 17:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231593AbhEARQZ (ORCPT ); Sat, 1 May 2021 13:16:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQY (ORCPT ); Sat, 1 May 2021 13:16:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 91527614A7; Sat, 1 May 2021 17:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889334; bh=JwEAoIwHkzBSAmAdq3Nrno00qVDCe+GWTUHUoWHQKdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJkZWUtYX795o038yqIPd/jLUSH1u1KhRWgGKpNSrWzAAyMm7Ll3gTnEmbARcFhwD mBeZPZSge2rdqPq//KzmY/gzgfmTkKNIET1I+UIr1I99gYy/Jku7Ag9dZ8BZytB6IE 6fG40LuxU1FRvjktzPRQR13aN7VxMBvvNn7IbjerBTJzcAez8wmKP9g9TToYyq/3If +fsdBTlKu4JOz6QmV3MQktDYlWB8SqHYG65Yyrb9TcYnlfI2vgQqcvhIwFrtrMs7v/ pBHA9UyVTGYjfgIwXt38DvKZTEFuEImyvqf/oSwpDEqzj2mBtABGtNwM1udAjBW8tl 0NSlcG9WIlzLA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Matt Ranostay Subject: [PATCH 07/11] iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:48 +0100 Message-Id: <20210501171352.512953-8-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted. Here structure is not used, because this buffer is also used elsewhere in the driver. Fixes: 67e17300dc1d ("iio: potentiostat: add LMP91000 support") Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Acked-by: Matt Ranostay --- drivers/iio/potentiostat/lmp91000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c index 8a9c576616ee..ff39ba975da7 100644 --- a/drivers/iio/potentiostat/lmp91000.c +++ b/drivers/iio/potentiostat/lmp91000.c @@ -71,8 +71,8 @@ struct lmp91000_data { struct completion completion; u8 chan_select; - - u32 buffer[4]; /* 64-bit data + 64-bit timestamp */ + /* 64-bit data + 64-bit naturally aligned timestamp */ + u32 buffer[4] __aligned(8); }; static const struct iio_chan_spec lmp91000_channels[] = { From patchwork Sat May 1 17:13:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB042C433ED for ; Sat, 1 May 2021 17:15:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFCF66157E for ; Sat, 1 May 2021 17:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231556AbhEARQZ (ORCPT ); Sat, 1 May 2021 13:16:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231566AbhEARQZ (ORCPT ); Sat, 1 May 2021 13:16:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D2E2F61494; Sat, 1 May 2021 17:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889335; bh=89oLJqJwIQXRp1mCCkHQbbgvhA/qytOulqQlmRBlKcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfjrEiay9E8n8Mj5dhuPjeg4vqvSlNzI4/TsQQsVuP4mC96Ou4yi+oGQOetJ1BiZi DBPd6am4Irmc1aQHu1mXRj1e8THTjy7Bxrak08SD40ofu/ybkRpg1XXmE1BBm3S3HC H5WNdayfQvTvuaMAehPQuQsf9vyCpUeqtRE6HLAMfL30OwZ1Q4iAQw+JHkegIAk72G 32zVVI7oh0ar8x3ELXjTe6ZLk0F0xy8ILY+yaslVlge8IDjbU7YlYh8O0q9gzOlPS3 37NuF2vIJZQz7qReXRkGnvwHGk9AmiJ3X9Kg77dhBi9+78MmAmPvSYoWdQzWgfmLQ2 yMLOm5/n3Ip3w== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Song Qiang Subject: [PATCH 08/11] iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:49 +0100 Message-Id: <20210501171352.512953-9-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted. Here an explicit structure is not used, because this buffer is used in a non-trivial way for data repacking. Fixes: 121354b2eceb ("iio: magnetometer: Add driver support for PNI RM3100") Signed-off-by: Jonathan Cameron Cc: Song Qiang --- drivers/iio/magnetometer/rm3100-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/rm3100-core.c b/drivers/iio/magnetometer/rm3100-core.c index dd811da9cb6d..934da20781bb 100644 --- a/drivers/iio/magnetometer/rm3100-core.c +++ b/drivers/iio/magnetometer/rm3100-core.c @@ -78,7 +78,8 @@ struct rm3100_data { bool use_interrupt; int conversion_time; int scale; - u8 buffer[RM3100_SCAN_BYTES]; + /* Ensure naturally aligned timestamp */ + u8 buffer[RM3100_SCAN_BYTES] __aligned(8); struct iio_trigger *drdy_trig; /* From patchwork Sat May 1 17:13:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA4FC43460 for ; Sat, 1 May 2021 17:15:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D53961494 for ; Sat, 1 May 2021 17:15:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231517AbhEARQ0 (ORCPT ); Sat, 1 May 2021 13:16:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:54114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQ0 (ORCPT ); Sat, 1 May 2021 13:16:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7F766157F; Sat, 1 May 2021 17:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889336; bh=ZdoKOV6oYT0V0AAEyVPG07gyiCCJZ6KOceGjN6nN0g4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AFTNyJxMTM8fg2K8+EHMjnAjWzqKY9afe3lEHcriUD6NYFdxyiCovWdhKzIyuPtHr 821XmAHBlPMKuxIpsLatGom3h+3w/thtXjBN0lIul0aJCh+4SXBCERs53G8mgBO7TZ oFAY8KOwRURKQfmAk7ryS61RzCaXTZCDJk//jUdBpm/KqVDU4/BZ+4ig3Sh7LAJBVS bw1XvlasuBwDvspGiXhS9y38P0sLpDlujmHFD72fhaZaYq7Q6TMe3nuK0Gcd+wfPuG Q8YWf//B6L+V5B28ER1DkS1DrWwW9L0dCpsSfeH4fyhGzQOIxtpzpqEgCNiGciwmHz izy08ODMVRiMA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Mathieu Othacehe Subject: [PATCH 09/11] iio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:50 +0100 Message-Id: <20210501171352.512953-10-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted. Here an explicit structure is not used, because the holes would necessitate the addition of an explict memset(), to avoid a kernel data leak, making for a less minimal fix. Found during an audit of all callers of iio_push_to_buffers_with_timestamp() Fixes: 8fe78d5261e7 ("iio: vcnl4000: Add buffer support for VCNL4010/20.") Signed-off-by: Jonathan Cameron Cc: Mathieu Othacehe --- drivers/iio/light/vcnl4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 2f7916f95689..3b5e27053ef2 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -910,7 +910,7 @@ static irqreturn_t vcnl4010_trigger_handler(int irq, void *p) struct iio_dev *indio_dev = pf->indio_dev; struct vcnl4000_data *data = iio_priv(indio_dev); const unsigned long *active_scan_mask = indio_dev->active_scan_mask; - u16 buffer[8] = {0}; /* 1x16-bit + ts */ + u16 buffer[8] __aligned(8) = {0}; /* 1x16-bit + naturally aligned ts */ bool data_read = false; unsigned long isr; int val = 0; From patchwork Sat May 1 17:13:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E8EAC433B4 for ; Sat, 1 May 2021 17:15:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7EEA61574 for ; Sat, 1 May 2021 17:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231622AbhEARQ2 (ORCPT ); Sat, 1 May 2021 13:16:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:54142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQ1 (ORCPT ); Sat, 1 May 2021 13:16:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 09BD7614A7; Sat, 1 May 2021 17:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889337; bh=5ueDYr0qt5lFLQGYzL/flyuvpjm0mo3gJVomR6JeEBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZpE6LXcCEhvv6H1E2v6ZqAMlItiwJHwnB7YybKmHNU+I7jZVDOqCoGSXdWiCz/6A KRA0QdZvJGnG0xzJGkjAdHShwmTd7yQu03QwSo8BbhbMfd7KyJGiid/kj8zShPsw4N EqkpC8zHgFeFpy+ZkIK0cIMz3pJJejsSXQVU/P06c7e935By5THzyg9+CPTCKXVuIK 8tUZ+xwp2Jb8HfkUadB2yXsJv+Vavb/dok2CtTC9eR32rfaGvxyxx75F7izXNHW6cH 9q19f7vyz4Hn2o5itOXSmxpAMQ8X+odTXMV0a0IkTgIiaqRpWQrPf5yMvBuvNBgdvJ rF2XHl8A21Q2g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Parthiban Nallathambi Subject: [PATCH 10/11] iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:51 +0100 Message-Id: <20210501171352.512953-11-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted. Here an explicit structure is not used, because the holes would necessitate the addition of an explict memset(), to avoid a potential kernel data leak, making for a less minimal fix. Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl40352") Signed-off-by: Jonathan Cameron Cc: Parthiban Nallathambi --- drivers/iio/light/vcnl4035.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c index ae87740d9cef..bc0777411712 100644 --- a/drivers/iio/light/vcnl4035.c +++ b/drivers/iio/light/vcnl4035.c @@ -102,7 +102,8 @@ static irqreturn_t vcnl4035_trigger_consumer_handler(int irq, void *p) struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct vcnl4035_data *data = iio_priv(indio_dev); - u8 buffer[ALIGN(sizeof(u16), sizeof(s64)) + sizeof(s64)]; + /* Ensure naturally aligned timestamp */ + u8 buffer[ALIGN(sizeof(u16), sizeof(s64)) + sizeof(s64)] __aligned(8); int ret; ret = regmap_read(data->regmap, VCNL4035_ALS_DATA, (int *)buffer); From patchwork Sat May 1 17:13:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12234931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD1D3C433B4 for ; Sat, 1 May 2021 17:15:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A42A1614A7 for ; Sat, 1 May 2021 17:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231566AbhEARQa (ORCPT ); Sat, 1 May 2021 13:16:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:54176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhEARQ3 (ORCPT ); Sat, 1 May 2021 13:16:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4EFD561284; Sat, 1 May 2021 17:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889339; bh=iSClIzD1y6bbrXowAJtqZH+dLQRYdmV8UT6/IyNpD4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vHVaEwsA6u/Mc8qT0/CrP+1Wg6yVDdRpJzjpHhMAiX6i85/5KS4JrvMeFjkkafCRH GmUatlthFO6zIb6feEpbKnBYPmduY+ienXbXIbqW/g18pHr3kaiaXJS2rW/TvQR7pC BPV93cxK3CxJ4DZ6j1hhjSJbzbNffRei5k0n6vsIfAREpa+EvIf0SAZIK3VjlQgsb/ aJibdD9UqrXwqV8ZyJEBL2nHCqROauTDmUPDEeU0Dv4y2eDutwDIiKPfyJzLE0z1/f jYHAz9ZNGyB7p1NG2Iep1q3IOmacsSv/bkwi4KpOn7xttz8QShDpXEI1KK7uPjApa8 66hEdK9e+68Qw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Mathieu Othacehe Subject: [PATCH 11/11] iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Sat, 1 May 2021 18:13:52 +0100 Message-Id: <20210501171352.512953-12-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210501171352.512953-1-jic23@kernel.org> References: <20210501171352.512953-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted. Here an explicit structure is not used, because the holes would necessitate the addition of an explict memset(), to avoid a kernel data leak, making for a less minimal fix. Fixes: 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.") Signed-off-by: Jonathan Cameron Cc: Mathieu Othacehe --- drivers/iio/proximity/isl29501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c index 90e76451c972..5b6ea783795d 100644 --- a/drivers/iio/proximity/isl29501.c +++ b/drivers/iio/proximity/isl29501.c @@ -938,7 +938,7 @@ static irqreturn_t isl29501_trigger_handler(int irq, void *p) struct iio_dev *indio_dev = pf->indio_dev; struct isl29501_private *isl29501 = iio_priv(indio_dev); const unsigned long *active_mask = indio_dev->active_scan_mask; - u32 buffer[4] = {}; /* 1x16-bit + ts */ + u32 buffer[4] __aligned(8) = {}; /* 1x16-bit + naturally aligned ts */ if (test_bit(ISL29501_DISTANCE_SCAN_INDEX, active_mask)) isl29501_register_read(isl29501, REG_DISTANCE, buffer);