Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9455353pxu; Mon, 28 Dec 2020 17:11:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhYtXFYGWM4TCyU5HjTxY4zZ2iz0pdtPWIEE9+9vZxaLyRH+/m0sD9HbZ4ryJZ6Z6sNzRj X-Received: by 2002:a50:f1c7:: with SMTP id y7mr44571667edl.184.1609204263253; Mon, 28 Dec 2020 17:11:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609204263; cv=none; d=google.com; s=arc-20160816; b=i9K87vB565OkgiVriNkFEUTPR1nRnQxmruwvlHP4389r1TmmLJuexZggUo06oRCIA6 wM/j8CGCMAnZxCV5c593xTx38A3ShJB3012qmMgrY78flGZZs/Aj/q3cKAlQg3kdJQZj zi8fjOkLI+SGROTNQ0bVd2YKB/PjgW57gi5cfefozEpe0CTvv2mhhX8JEy4O7o90sHCT OqpIiDAQyZkRoZILEq4zexEYY8pAN1Rdo+kt2U+XgkF+PAr5jk7BnE6cU7GHKGfGQbcw qgpcVHe+HWkfn5+EQqZsifUPzVIWFUYPR3ZWOruYrpoIcF9nDKqcd5h9DJ316Zhp1XWn ZjKw== 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=u7IeGOk9xZITrI1Wt3SsayyQIV+v92F3Okt3rwe94uw=; b=ZPooaxW0pj7I7bLWQiDdu2U5k6eXtdyFL0cRiZGH6nPlzCcP58K/IUSyaiocrP7Kso XY0aYPRI1wxS64prcVrLwm/65Nd3/OKDC1AI+VhRndHKagedB+p/ElP07x7GS1J65evl C4f+QSHg0sCBnh1dHinGlqCJE9nB370C9dS4A+v+ugjEUbx1FIUDftt79j/H5OOYFFYo d8WrLwP3q7F+BoFjMdQWeES8XkIGHkAKtSUQsB+XwptNvvJYqeO2vNmCa8Z+5mtn/wZO KPPCeM8MnKIpDp3KOj/RMEDTeRFxlmhNqzXfvDNfcPMjj3rRNVKV+65O/LeJsLT6kuRy rBIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oI6kZAi1; 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 y7si6925581edt.257.2020.12.28.17.10.41; Mon, 28 Dec 2020 17:11:03 -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=oI6kZAi1; 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 S1729975AbgL1QfE (ORCPT + 99 others); Mon, 28 Dec 2020 11:35:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:58372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729999AbgL1NCM (ORCPT ); Mon, 28 Dec 2020 08:02:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF7E622AAA; Mon, 28 Dec 2020 13:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160491; bh=fmP7GaXeMEkM7Sf25bDFeA59vczjwB2f6e4UvA/ItfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oI6kZAi1BEekDfYzld7vRnH8ruFqybjSoDbredA88PKDbmC6Vowb0FftlrxChVCO6 +Z/7oCdfuwUpLuvy6z+L6GDpbEFjjc2NDbpN+ZtAN1R5V905BeysSQtQJt/vj70G1B 1v6p6mj9MmfmDEQhQgIgjzDM+hcqMN+cjR6srpi8= 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.9 070/175] Input: ads7846 - fix unaligned access on 7845 Date: Mon, 28 Dec 2020 13:48:43 +0100 Message-Id: <20201228124856.637983927@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 9fa7ae12df80a..b77a2178fdec4 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 @@ -410,7 +411,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