Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2727526pxj; Mon, 31 May 2021 09:13:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+tcJX3cu0nWwGPq3mUVuhAuOcB+7quic7kYukGn8rT266KGdtkODuVLg25RSgy5im8SNK X-Received: by 2002:a05:6e02:b43:: with SMTP id f3mr7702725ilu.22.1622477612376; Mon, 31 May 2021 09:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622477612; cv=none; d=google.com; s=arc-20160816; b=al40cfa/GD5IaZOOfA+XLZQMVSBsWKof6m4GwG3BJYNCH4Xfm7gviw0h4hHgXJXG+3 DtUzVC8Z0HWyUPXv6JHSrzyNU1EOvofxd86GquGH98cXYPpGq6VWpJGgmu6PEwdsVs4e QtDXOcdC80bEu0+DuDjHLu678xpIhYoyFQ0HsVrmvg23NHyG+XjSOfncnesCgeg3dJkF 9a0BrmTx5ROpKkeKIWLkkdjuOPXbNkv/bkv9WZ/aEwtS5PKA2veVNJVlWwyvFCZuRHbC Bu0q5aTXu/k+Zz49XKSWeerwgSmhK7JcTsrr1MbDWRKCW69hB9s532pddEFeV8n1y9M0 fUtw== 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=aWr8EGmnjWOo3p6YP+IQ0ePOF/GouvpaCLnW/CUTTgU=; b=pt5+a2Dv0kBc+egzoWUNNQOwhHotlFw8DxI7tw1lJqoUkaHIEebUMt14Gugv+MWGc5 /P26K2FDf2CDoDUVOujsPNCbsOxmaCgfCPla5bOS+D2GCWwtXjxnxv6w/aqQ1DrRbMM6 O5tgZnhpD8mQ+qm4K5i5eLuq8PH0gbdvqkDyBUkriWd0cN+h2ZnOW7tznFaXDKqQyTqJ 7xFQRm6tJTFkxyOseCu9+WD2MCSqcHa/y6/5MHjqF00VQHR7RzGlbc3RtLn7CsNAhhAq gbH2sSARFPlw33iydRv5xyl/zHtoOHNHBtBDdkyM5JJZbBcegadQG9pWOndzeywRCiyf ba/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wFhjsLiu; 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 g16si16357577jat.43.2021.05.31.09.13.18; Mon, 31 May 2021 09:13:32 -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=wFhjsLiu; 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 S232604AbhEaQNr (ORCPT + 99 others); Mon, 31 May 2021 12:13:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:33230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233959AbhEaOhh (ORCPT ); Mon, 31 May 2021 10:37:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3F82961C56; Mon, 31 May 2021 13:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469123; bh=CTOq7VVM7Ni3yi7qRiNv4fNQie3EkSonQ2SRJ0iS4jo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wFhjsLiuNgUix9kEKjKH+UOtqvf6Orh1UNRzFrxQmnBKh5VZiP3+eTFl5Qma8b0sn B2HQaadOuasPyNpLZZ5zjUYG2myIS8Flngo0125OK3AK4gdwBypbhHZfhchDegR6Gj E8q6j4TeyIrtlpdflRvpzSexrEpVKLIB1jnbHse8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Stable@vger.kernel.org Subject: [PATCH 5.12 078/296] iio: adc: ad7768-1: Fix too small buffer passed to iio_push_to_buffers_with_timestamp() Date: Mon, 31 May 2021 15:12:13 +0200 Message-Id: <20210531130706.476550184@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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 commit a1caeebab07e9d72eec534489f47964782b93ba9 upstream. Add space for the timestamp to be inserted. Also ensure correct alignment for passing to iio_push_to_buffers_with_timestamp() Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210501165314.511954-2-jic23@kernel.org Cc: Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ad7768-1.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/iio/adc/ad7768-1.c +++ b/drivers/iio/adc/ad7768-1.c @@ -167,6 +167,10 @@ struct ad7768_state { * transfer buffers to live in their own cache lines. */ union { + struct { + __be32 chan; + s64 timestamp; + } scan; __be32 d32; u8 d8[2]; } data ____cacheline_aligned; @@ -469,11 +473,11 @@ static irqreturn_t ad7768_trigger_handle mutex_lock(&st->lock); - ret = spi_read(st->spi, &st->data.d32, 3); + ret = spi_read(st->spi, &st->data.scan.chan, 3); if (ret < 0) goto err_unlock; - iio_push_to_buffers_with_timestamp(indio_dev, &st->data.d32, + iio_push_to_buffers_with_timestamp(indio_dev, &st->data.scan, iio_get_time_ns(indio_dev)); iio_trigger_notify_done(indio_dev->trig);