Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9174604pxu; Mon, 28 Dec 2020 08:25:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNIl3EzwOsvnhy0px+GKGeuYsSDYw1V0Kzlprv1HuuUlIdm4529eRPgRarYkC0qhw/gIeQ X-Received: by 2002:a05:6402:513:: with SMTP id m19mr42937190edv.244.1609172750590; Mon, 28 Dec 2020 08:25:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172750; cv=none; d=google.com; s=arc-20160816; b=upkpDeqdH6jy/jXEPcVbs5NugMkTHQ8N4wbmsmhpHbQv/xpim3Q/WAbAuwPfQbabIP 0G7roDA+Ol50TRsEal7GF6KGHOy3LYWMw0WlKbcEQQLpx/VIn9A85p+yYYqE91odTnZH NFbdeAFOnt+ppzYM9dcWgL5jvQbez8THV48DB2R4F7b9EmpR60XbWcw4pL4NMfuR2yRx eVki6E/dHPM3Z/75p1sju0Ku8rrGeMx2Z4NdXtcQ1K0eQUh6SlgS+JuuRY1KWcnFKsDD lqDG0N1NG29p3tV01jsmy+nRu+7cG03z59syJuTxQFe6qGDXX0znASVkmivHW+NRgKPj Yvwg== 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=z1vNSwoM7qZ4O9TrAxojYYVp5qEa3gKy/2l5aa20MLM=; b=0ELeybHKxqvvJnndbJeqSu61pM2EyVPOA0PEfSRhczT+6ImXssuA/NnBE7Cbecf14F fbte7BERphfag5UPIgKGM3wLty7JcMfcKqjPiBQlfnW6fevyEsOkShc8AlNJHwjHh5vG CLXgyal0Kcz2c35lpmZAOoJIPfE0XCVACRQcnhMVkg/OGjdaNcYmN8qQyFYmgIj333rt DCo/pAhyiZ5+ZcQlaCNPuk3Nxzf0KZUOHhlNRhcE9AFG9HPdFDYpkrZ/5A2dK+lr1Al6 vuTsPpMMdr+GSlYPsyuqQXR1YwjFaL9hFx6RiGDXKd+ES4XkJyTNRG/Q/tlocr3vCwmp ctUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="u/S7Rvul"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 v24si11032452eda.114.2020.12.28.08.25.28; Mon, 28 Dec 2020 08:25:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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="u/S7Rvul"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S2440978AbgL1QXQ (ORCPT + 99 others); Mon, 28 Dec 2020 11:23:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:39566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731873AbgL1NLx (ORCPT ); Mon, 28 Dec 2020 08:11:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1B00C206ED; Mon, 28 Dec 2020 13:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161097; bh=WF8aRP6p1aUlzCdp0ecf9XIz/Sv0Ovile1e3WDDEPS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u/S7RvulMcwgU9IK5fXlST815ZEK7oIfaFBLhMY/xHmlt4kGynS7Sj6oE7ovPDYUC tt3h1eSXqzwkQRg9tMCybC9ciai04JsHdHXgLlU8cUdpFEYJJhVOpxyNKKLZuX104I Gk7oWv9AOmz1Rm7RZ1XvVHmGN9QCEIdQRSzjZ8q8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.14 099/242] Input: ads7846 - fix unaligned access on 7845 Date: Mon, 28 Dec 2020 13:48:24 +0100 Message-Id: <20201228124909.565611099@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Torokhov [ Upstream commit 03e2c9c782f721b661a0e42b1b58f394b5298544 ] req->sample[1] is not naturally aligned at word boundary, and therefore we should use get_unaligned_be16() when accessing it. Fixes: 3eac5c7e44f3 ("Input: ads7846 - extend the driver for ads7845 controller support") Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/touchscreen/ads7846.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 7ce0eedaa0e5e..b536768234b7c 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -35,6 +35,7 @@ #include #include #include +#include /* * This code has been heavily tested on a Nokia 770, and lightly @@ -434,7 +435,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command) if (status == 0) { /* BE12 value, then padding */ - status = be16_to_cpu(*((u16 *)&req->sample[1])); + status = get_unaligned_be16(&req->sample[1]); status = status >> 3; status &= 0x0fff; } -- 2.27.0