From patchwork Mon Jul 12 06:10:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 472852 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2647441jao; Sun, 11 Jul 2021 23:29:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqbBAYYmLm6ND2LpLYaOmmCiXdR2+TyW1JYQBU+I3k9tSrDuAtf+XpX8/nnb+RsQaECebs X-Received: by 2002:a05:6402:35d4:: with SMTP id z20mr65533908edc.138.1626071352858; Sun, 11 Jul 2021 23:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071352; cv=none; d=google.com; s=arc-20160816; b=e0Z0Mh2QQkSeXoMe0X55ez8RX5R/sJNuhroCO/KFc9fve/nCXaJa9UaBes/qBrKVhQ HiauJQOr8KZdHbsGxdxpaYNMySv/phWxLWMzTZZ1ZcBcu6Rj2HJ/0bSaCNjJVu80SfOT Y0TcNtXXroiWmMA1/K+pHtmxK8czie4Ny5fnhAJoT+uFznK0LkBElTPlpLzH3afldaay Wacf1SSA+hBOuLy7YnocLFWhC6DYbK8FXopiht/BFoUS3nkSZyQnxj039L+Ckj2fLrAS hE2yS7B+0eKRcvvgVjoEyMGIDYAvSHxrC7Ojicqu+K24qHR4RE0kLHeAkInW1znU/roW ZM0Q== 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=44sFwQAn6vomDoYsU0TWV6/XmXI2t5RZk+i1pTpXu6I=; b=bJ8gxvkqbJ5GwLLY17HItK7jy5h7njjiAYkt4fuOlphmxG3enuHHG6hc9opc2KXhn6 C+oQNbUhA99ATMQEFpUPJ97EjW4vsniKPjA4vrGwW/obXaZ+ds0MLv83VQLxGh9oQ1UF +Fnv8E6df4jfHH08rsVfedFOdRNGadPi03LaGnSAhE7n7sNq8XBhu3BXR9UuI5mdwCid DYQjFlqn94lKWg9hSoP05UUfoGRAf0zSraTDxelJPINmRi2jOjwffVtSRKYU93+krT+o /9KYHEZFENB4sAYMAdrLEwXReffsrbnE2pEq5RWekvp5oBAdwJhxILEOHxQCxD8Nz95M dqsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P2VUvahk; 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 bz6si16420285ejc.610.2021.07.11.23.29.12; Sun, 11 Jul 2021 23:29:12 -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=P2VUvahk; 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 S235198AbhGLGb0 (ORCPT + 12 others); Mon, 12 Jul 2021 02:31:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:45560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235134AbhGLG2l (ORCPT ); Mon, 12 Jul 2021 02:28:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76886610A7; Mon, 12 Jul 2021 06:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071092; bh=BKhx1bXn4oxbPRHL0abpXi5vsnZ4lkj/deQv996IdUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P2VUvahkLcQufiHBgga7VMwrji5mHqE+Z8pWKhILeHRwoC9GZ9NQOdRya1ew5JEM7 tK38Bfv9I/gJnQ5DdhrrIburDKa+Ij+DDqiUUxG2MeU+pd8uXB1LaKbIq0XSlMXg0d 3igsKXeS3eIR8DKnE1bBvFrnhzTSiy89VNytao8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andreas Klinger , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.4 272/348] iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:10:56 +0200 Message-Id: <20210712060739.746722456@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 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonathan Cameron [ Upstream commit 19f1a254fe4949fff1e67db386409f48cf438bd7 ] 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: 78f839029e1d ("iio: distance: srf08: add IIO driver for us ranger") Signed-off-by: Jonathan Cameron Cc: Andreas Klinger Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210501170121.512209-13-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/proximity/srf08.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.30.2 diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c index b23ce446b7be..c99bc514c5e1 100644 --- a/drivers/iio/proximity/srf08.c +++ b/drivers/iio/proximity/srf08.c @@ -63,11 +63,11 @@ struct srf08_data { int range_mm; struct mutex lock; - /* - * triggered buffer - * 1x16-bit channel + 3x16 padding + 4x16 timestamp - */ - s16 buffer[8]; + /* Ensure timestamp is naturally aligned */ + struct { + s16 chan; + s64 timestamp __aligned(8); + } scan; /* Sensor-Type */ enum srf08_sensor_type sensor_type; @@ -190,9 +190,9 @@ static irqreturn_t srf08_trigger_handler(int irq, void *p) mutex_lock(&data->lock); - data->buffer[0] = sensor_data; + data->scan.chan = sensor_data; iio_push_to_buffers_with_timestamp(indio_dev, - data->buffer, pf->timestamp); + &data->scan, pf->timestamp); mutex_unlock(&data->lock); err: