From patchwork Mon Jul 12 06:11:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 472849 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2647322jao; Sun, 11 Jul 2021 23:29:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwch7tbiZBKiG97H50PVYrQt3arJ8iQtE6hP+99UJZX34yekrs3CAzhJewk95Yk7rQ6qjso X-Received: by 2002:a05:6402:895:: with SMTP id e21mr10549982edy.9.1626071342814; Sun, 11 Jul 2021 23:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071342; cv=none; d=google.com; s=arc-20160816; b=Qv5HwE07sKUUJRQ1JBmChdqSpqK397eZnCGgT3bpL2G0LNkVBuIG9Jo5jO6nX8W9zs v9YJUhQQ/iornNJszmj81EhtWbKo68V1zbV3YbRvW+/gz2BGenedlen5c7/1CKwC2eAE kssUiGI132F8pKgCWJmEJ/C894hcnn+I4clOn2oqQ15vqzi5YlOsevgwWB2Ou9QOkZuM PVwtRUh4ArVXYVa+Doco8SLJR+LlDpSpjK7E6HEGttEBJ0opFtit+m9DdQgNTkcsTVXT fLjqYoH+/h6pwoHgatC4HtNHmQaPRo+sxj0lFvOO60VoqmlkmOPKAzRDvReWPcLC9odf lhgw== 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=B3uwED8ZvFtFpzbC1YTHFPt61hq2aDeI+LvgUpemJck=; b=xUwNThVnF0dQUicDEIkf9E6VNEMFXk1XwtnorB/FXHWW+BwRqwfXnXTeCM76bSdDNu 3vom5RlLW5B7z2Mmml1s8mpeDX/3/Oe/rAC8M8CFkJ6C0yWiX9NwuHGYe87nErQIGGKk ntiTpdIVrd2+uhc0M39Y5TSOPSNzipqUjH679pv0w7j27Srs5IaWQWswCqNyO9LRiAvO H9har92XZpDVvLpqZD15G6nnbhdoQB73H+z9/nUU3tU1bFXntDyH8h0lAKm+odHRDFua r/Aj2NIGcfLm1hnX8gy+ukALAcDghmsqzWonVuLYhWNbSQA6tZFLYhUyjLPDe52YYyX0 UE8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TL+N/y10"; 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.02; Sun, 11 Jul 2021 23:29:02 -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="TL+N/y10"; 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 S237416AbhGLGbG (ORCPT + 12 others); Mon, 12 Jul 2021 02:31:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:47700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236061AbhGLG3n (ORCPT ); Mon, 12 Jul 2021 02:29:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0B54D61004; Mon, 12 Jul 2021 06:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071207; bh=abkQn85XnalsqVeO5JJoffW6YRv5zu+z8YGtkRC7FDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TL+N/y10zLr3NEeQffuBxp49d6TdpHfF7jlIWBUd1xrpHZ3Cv5Nwzi++TlKYb8W7M gBj/V3jZWyk/KMmA6P3miSpwH3c2AT6X9ud7DQMho9lhL4+LZ/k7x2mXEudE5R7Lll SXmrH1G4RVahE2IawWv5CG3GGR7xZI6pTsSpwBzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Parthiban Nallathambi , =?utf-8?q?Nuno_S=C3=A1?= , Sasha Levin Subject: [PATCH 5.4 320/348] iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:11:44 +0200 Message-Id: <20210712060746.472357002@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 ec90b52c07c0403a6db60d752484ec08d605ead0 ] Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted. Here an explicit structure is not used, because the holes would necessitate the addition of an explict memset(), to avoid a potential kernel data leak, making for a less minimal fix. Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035") Signed-off-by: Jonathan Cameron Cc: Parthiban Nallathambi Reviewed-by: Nuno Sá Link: https://lore.kernel.org/r/20210613152301.571002-8-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/light/vcnl4035.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c index cca4db312bd3..234623ab3817 100644 --- a/drivers/iio/light/vcnl4035.c +++ b/drivers/iio/light/vcnl4035.c @@ -102,7 +102,8 @@ static irqreturn_t vcnl4035_trigger_consumer_handler(int irq, void *p) struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct vcnl4035_data *data = iio_priv(indio_dev); - u8 buffer[ALIGN(sizeof(u16), sizeof(s64)) + sizeof(s64)]; + /* Ensure naturally aligned timestamp */ + u8 buffer[ALIGN(sizeof(u16), sizeof(s64)) + sizeof(s64)] __aligned(8); int ret; ret = regmap_read(data->regmap, VCNL4035_ALS_DATA, (int *)buffer);