From patchwork Mon May 31 13:12:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 450513 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp887540jao; Mon, 31 May 2021 07:39:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN3kuIonHC+fwzv9tFR9lK1d/eNyQ051Uh47QXXHNt5++2YWCh1pulQgOY7BdGVhi03swg X-Received: by 2002:a92:b506:: with SMTP id f6mr5427945ile.148.1622471953325; Mon, 31 May 2021 07:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471953; cv=none; d=google.com; s=arc-20160816; b=GPSqSbVDLFpUUebPQ5LXig9OHZdtPcoQAKkwr/Zu61DAXuH8ZqXxGKoRqvliHxxmu/ mjeUe1WsDmRgNJ0ZCRb/grKgosINJZHayuPkLEHB3mC3jumCAbttZEO/UhibJjzGkCjg aWsPDk8z06jKvYRuMMugXGXOtwZK5Sx7s1STHdZqv1gBdk2W6eXfpS0J8g8AYw/oZI/r 7dEh5Xfam47JQwzSqJX5xMfcGrTpDIERX8AM+vkLHl7QCgeCLZeaCiM9y9MZIix67UwN yBZ2CdmVbvM0rHbZirI2TKb6fbTFMYcEFwT17HwFmfj3LkWqfnvERNpg1M6YxynsjnjG a3JQ== 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=l2M/tlqddJbk9nbX+ZZZuUdvFXUoqUncZ1hE1wUMoNl4O+1FcRb6IDZ8sovu2uRGq5 /09y1XSxIgQPAfU7eNSvrsC/V/o+hi83PstPWeDQmZI7/2gSU/JLfDupihbPeWYUOHFD bd462BfLIlGodtW0ydJaga+rVj8JKRktcxz5V6Ek/+k/uVR0Qr5NioTagJz7ZzmIWG5P 3ICJBOpfgiazvMQfKPq4a0/4hC1bWpr++Txr015P3xr6udL/Xt7HQF0APdtf22Lizew2 jueb1tJG3dsOnBQrPjJhXxQwovjLtxQe2ZmWf2lmqW7wPGHK3042y6YAE81bVJptLKkB h5kg== 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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 d5si13573935ioq.28.2021.05.31.07.39.13; Mon, 31 May 2021 07:39:13 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S233001AbhEaOku (ORCPT + 12 others); Mon, 31 May 2021 10:40:50 -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 Precedence: bulk List-ID: X-Mailing-List: stable@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);