Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2654117pxj; Mon, 31 May 2021 07:29:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv9kyQyejY/A8fxZ40ULeXMYVachp/WR+1tXegqZ2dYIeD7UPcqkaSab0nbB+OrhmE9olg X-Received: by 2002:a17:906:3845:: with SMTP id w5mr18856918ejc.466.1622471368115; Mon, 31 May 2021 07:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471368; cv=none; d=google.com; s=arc-20160816; b=L6Xe4Vv4Nom7gZQWsgOozNFVRcCzSHu0ZS2scGw0b2n8nwJbaF7W28YQl1WVbtTkrp sZ2lhfDBm8mwhjStQiuIk+pmatZiRecbXt54YW6/CbmDbSo3YlUN1BkgWzQy2otfqRyd JDPmmzh7+2ZJ+LHEu9SJQWqE6c0/cc4EUmFuCiv6edykNrA5x5kydqjljLh5lqnrTvy5 sCRdX3N/+z4PXZPiT+FnQJgt3xJ50esSV6G+AA9g00W8pcx3zlWn0+q9Fda2hIuApC5N 6LCEO1uegwTApMom0ppTfyezyzyp02dqC1/a4HV7NMdfi7+ESDm6uOIxHg9GjOw790yL ewlQ== 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=Eram04ylJh5hftvFG/cy6AlclZVApUGHdcju+MYDgL4=; b=b/Jk6OSTlCJkcM44M0Gat0UQfvOtIkiGBygzEbtakusxsxJ3YFMHPAExJtLBbJybdA uGGyfDqPt5RmHN+1xymIBbzEhqclLgeAD/mIFR8kVYUjmFs5pnDXFFAlSNCo3XsUL/M5 6yrfvOEJmuUIq8dql1li/Pl9c/ObHYYPiGpPAGzC5UqAPkmc/GD8vIwN8wgzleoDFqwQ X+YKL5JRw/9TjwXfZmjgG7Z6mUfLE616v1Vf0YqmIuJ6HP/OIYvyZ9cSrwESqO5QeDSr ittXFP4hvr9D0gwSkzSNGjfKXrYx4qof2p1MzmsJJF3JXGE23TDJpswXs0RfIGktM6ud z1wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H5lLLpe9; 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 v1si15538800ejd.643.2021.05.31.07.29.01; Mon, 31 May 2021 07:29:28 -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=H5lLLpe9; 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 S233953AbhEaO1l (ORCPT + 99 others); Mon, 31 May 2021 10:27:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:55360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232479AbhEaNvr (ORCPT ); Mon, 31 May 2021 09:51:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B78D61874; Mon, 31 May 2021 13:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467957; bh=piYdyNL1WQOyltnBpIV83mNDkIEQloyOxsth3vJvFG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H5lLLpe9FkFQqjkFsDioe0il0v/Qo48+PAd9O4qHPIvg6b8ZiRT3K2qG5ZFq/seeQ 9yqZudpDw2dIRVwKlpY1yybyNm3SF3Js0TxeeLfUd19DuFiKzZDLaVDYr8DC85L9wY DaRSa7VdFmyY7vM95PBL1A0oZS6uM1uZ4BjEHTfQ= 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.10 063/252] iio: adc: ad7768-1: Fix too small buffer passed to iio_push_to_buffers_with_timestamp() Date: Mon, 31 May 2021 15:12:08 +0200 Message-Id: <20210531130700.125240846@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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 @@ -166,6 +166,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; @@ -459,11 +463,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);