From patchwork Mon Jul 12 06:11:52 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: 472998 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2687478jao; Mon, 12 Jul 2021 00:30:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrCOMTC6SNPnwdPoQQaFUnBk3RgJIst+m0M5NA66fZWsPkcmBd9bvFGVH1Mb+hhJsofB2b X-Received: by 2002:aa7:d48f:: with SMTP id b15mr63025380edr.7.1626075044214; Mon, 12 Jul 2021 00:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626075044; cv=none; d=google.com; s=arc-20160816; b=BG7VpvluubYXSfJbUH3AjgN3xOn98ulu2roSJJPndi2oTusY05bOV/lMEyg4hTebMn +salV6FRnIpMbJeklihKSXyo73NLdhpMyH2cGkb9pgA2VI0eojiLcxQjPOEurbmuNft1 rr6J3+tYg7D0JA/wBhqDyGZdH25E5Mg2QoPtoc7eukfazB5hR1NeiJSQ1eJBP0qN2jTj BuaaCHoV24qgcXzb1p19CZD97OO27u/jvQXJKiqXIg5yzfpN0gJyzIHxDMqQxZRaOkOe eckICWAKwHcBcaRV8EJIwiI4y0qpnPfFKlyy0MHXfKeDJcZmo/OPJWbsnIuQkVEcB69Q mNdw== 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=94ths84zxurxnfcRLATx6+pVhc1E6hX3TEiQLWcLMDk=; b=M+nJ/Ix2UnYP6sAuOQX6FeThCuNQ+tn9AclOMhHXHlYTJ9FJitgWQREQTf8z/jYpj2 pLFb+lSSMcc9yBZ7S/GjD/z/Z+GU4Gr9DyYwV8adWZEY57T1U7a/RCuY+cFwnEG8KC0l urfozlouqwNwyYiAr4d4wbMGj+HSDoW9pfaYR5tk8yezPApF2h/JoKKfLx9EVBNm/iLz XvAXiZ4nFX8dn1f3/MBaQ1iV0XnorNFkN+R4RqfBGjzINE/kHNhY+SfxcKZtXqk6VHnz aIrWp5zyWtHPNWq1oiaSKLiHNLXxnqAA3RVhcTkWLpGjdnZm5yZzuKqINRcDev65gUoW 4hfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="nI3e9/rn"; 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 e9si16596658edv.146.2021.07.12.00.30.43; Mon, 12 Jul 2021 00:30:44 -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="nI3e9/rn"; 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 S1344412AbhGLHbv (ORCPT + 12 others); Mon, 12 Jul 2021 03:31:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:43680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344416AbhGLH3c (ORCPT ); Mon, 12 Jul 2021 03:29:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02DF36145F; Mon, 12 Jul 2021 07:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074713; bh=S3Sx+v1OSpD+g9scBubEcoo7+TYplDZ0tvOS1aO0bQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nI3e9/rnly3Ztd4iMQ7nJ3H6qYcd5Wn1luCf5Flm3Vnl7IhELON+HyNtecbS0Kl22 iRhOnEnbX7fUDou3zVws6czDXkM0mjhAVxf09DhfTSno8o6FHbYzr4EyYX59L8SLxB GKzloBlZYZ0uTSkhImGAguQkwRddFMxVkg2BDOS0= 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.12 629/700] iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:11:52 +0200 Message-Id: <20210712061042.771365324@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@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 73a28e30dddc..1342bbe111ed 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);