From patchwork Mon Jul 12 06:11:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 472942 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2665257jao; Sun, 11 Jul 2021 23:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6auhoACkcQm91xI3w3AwR3Ip7SuSoO36Rvqu/EyfPBr6biBYAZwbE6Zd7UyBicvmKb0d4 X-Received: by 2002:a05:6402:6c8:: with SMTP id n8mr62754075edy.180.1626072674818; Sun, 11 Jul 2021 23:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626072674; cv=none; d=google.com; s=arc-20160816; b=a5WK+y8Q80+LKD5DUv/42BQjV1eenQih7/TQr74+ZYZL9SwFMHPQmDOC+3sqVOClq5 /mvfueI9VXDRIGCcj4aajpf58K1ZkMbzJyh9TQRn9owH3rvxF5JuxvLPgF+9JW4bjOiw Zfu9eWzzMomsjTDnkne3Mqi2EaWKlcS1mVcHChYJ/G/etxYWyV7+oSI7wEi+zEVFx1jF WBm+/KYcAj3tkEWMhw6acv9lrf9jiFIJ1DISyum9vym6hrptJCamBCnJVKysT9mRWIyk L0jBpg+QOhoAGtW5sSSLDvJ8izBUd3YuSC3XTkTVQmiUHZW6GHvp4IJl1m4onLUE9QXY bvRw== 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=cDZH4tfXInbB9VLSA1XAYAx3xApXbudasC7v7m6RQBs=; b=tYwSqGg9hcJ8wswNcxJ2uyoSx0ZD52Mgxg3ymEEOBmqnhyQvqcAaxBF/+L9qKqXyD0 O9X+CCLXzCiQDFWmdvXgvzKgMDMVExIt6sMK6Jr8rg5mxGWy6IUOLTMWpdG5njc2hypH zgaeSYLiWIBQSB/SVDa8eC8WapyKPRyHHX26qOHnMvNmnO4Pt0f/4KogSD4RV+QtlaRB WdJEhyBBXiAmwNGOtl1060HwETb5lxqtcV6cEk6+639Z64hhD50iuSaj91oXN755MNsF Xt+OsIAZdYDwE44JbAmlx2JTBRRri9qYVT9PmlsmWQVUJr+ay9cuCB4olYwTXJB87ZY2 YNvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q7i+5NH1; 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 r25si3440466edp.437.2021.07.11.23.51.14; Sun, 11 Jul 2021 23:51:14 -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=Q7i+5NH1; 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 S239877AbhGLGxP (ORCPT + 12 others); Mon, 12 Jul 2021 02:53:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:51186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240405AbhGLGvw (ORCPT ); Mon, 12 Jul 2021 02:51:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 03B3961107; Mon, 12 Jul 2021 06:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626072530; bh=WdTOqzhsaeatgfwqF1jV34McTHBB+98HqcQjJygCbNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7i+5NH16B17CIBloV70jGeZvrUXxnO+3BrtpxAtMaUg9eIPirxx7c/IVyBKgeUZm e5CwDglbOerCI9hwpoWE8/q3MzBEbilIqtlxPLkiEOIIHkG2ONrv3wUTN/Y/zRMz51 F9mZgabiRp52Mn6Cx+Y9ZJ5RZuobuSCNaAnTHOv0= 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.10 529/593] iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:11:29 +0200 Message-Id: <20210712060951.544659435@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@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 765c44adac57..1bd85e21fd11 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);