Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2711889pxv; Sun, 11 Jul 2021 23:30:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx58ZL5R7Ypz9IgGD/0pjfBkc9vkDHHjF0zpRewW3EfnrNVeA3nQEdMt0Y6qCR/MadSHwNr X-Received: by 2002:a6b:b882:: with SMTP id i124mr38907159iof.80.1626071439043; Sun, 11 Jul 2021 23:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071439; cv=none; d=google.com; s=arc-20160816; b=o2RLLmXtSmgqCbfpOs3tiTZfYI6aj+UmVlksses1dEGtlkERv8oSNjGTU5v624Ubws jQVhtGDmi60vOd1lAzvg+Rkml8g8Xrf0IlZ58O9DoCXTDLTpEha8vFbLGhCzt3QE/Si0 Vv8OSfnhM2V6S+nCdawjwK+Hd9lP1+QVYfctEu0M3TA1266tfEcW7bTGQZFmj5Gxz7+U 5bxA4bPlPwIjnz4UuWJoqlfQYTrU1UHnQgqdsnng1hJPLy4Zhl4iGDt2Yrh0AJ6OD44t 1QB0wRWfAMvJIo5jFmiFhtjazOztcRXfhE+6yr9BeviIoIMUxq1NdJyC8ILlRtTNPhsZ DVow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HkOzDUZO1IqWywyH3Wf0se8ges46VNpxNCM89t5j+es=; b=Fb/xO2e45d24nPmE4cpPeGmqfYzUDt9K8Dct5Aa5xzTZsSxgTO7wsB06JwCBTuvyAM ZW+15RGIOYyvREE9G0FtWV6dwwTCemsBXR2ce/X7gEGRU8IZfjxc56rQoyE09YYcolQl DJMb+nOPsXdTlzM1NsquN1OoHZaXPSiiAqiLuwwEEehu/SPhY43CtzbJLPXIztKCUrgJ 7YHy4qmQp364RV4qZRLYoxB5RsIMiBZESjpL5P6WF5toEA61zhBoblvQdwliq6kf/Ugl 5VeaN6Cmkf0i6Gx4Esjw2j9XWda9EtgIVIW31xHQ8qHu/zcD+zUB+EDrL8B1kJKLWcoi ewqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SKIjmRIx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si17504669ilq.82.2021.07.11.23.30.27; Sun, 11 Jul 2021 23:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SKIjmRIx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235688AbhGLGco (ORCPT + 99 others); Mon, 12 Jul 2021 02:32:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:48518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235152AbhGLG2u (ORCPT ); Mon, 12 Jul 2021 02:28:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBBC6610CD; Mon, 12 Jul 2021 06:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071107; bh=t73rlMJNOSD3lPi6PGJim8kd/BxNWSjZ872C0Kpw20o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SKIjmRIxErMU61jDbxd+Hjl5EmbLu7RaZt6K3iSUV90EyqnwkuxmvopiBgtQe8jYc lGxiObP3+ltMDHdYCF2EvM7oedPvCOyDtigXlkQR0slzPyDqhUDxmVFElLDSSCy3jk cVY9xFCSnZ93b38O8XRZGp+lmwV2XEXE7QnpRcNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.4 277/348] iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:11:01 +0200 Message-Id: <20210712060740.425972294@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 3d4725194de6935dba2ad7c9cc075c885008f747 ] 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 uses of iio_push_to_buffers_with_timestamp() Fixes: 6c25539cbc46 ("iio: Add Intersil isl29125 digital color light sensor driver") Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210501170121.512209-18-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/light/isl29125.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c index e37894f0ae0b..15906925e588 100644 --- a/drivers/iio/light/isl29125.c +++ b/drivers/iio/light/isl29125.c @@ -51,7 +51,11 @@ struct isl29125_data { struct i2c_client *client; u8 conf1; - u16 buffer[8]; /* 3x 16-bit, padding, 8 bytes timestamp */ + /* Ensure timestamp is naturally aligned */ + struct { + u16 chans[3]; + s64 timestamp __aligned(8); + } scan; }; #define ISL29125_CHANNEL(_color, _si) { \ @@ -184,10 +188,10 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p) if (ret < 0) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, iio_get_time_ns(indio_dev)); done: -- 2.30.2