Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9124460pxu; Mon, 28 Dec 2020 07:13:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxB+rRonAFkWCrkIwzMqQVh5WDGNeaWihSwAGUXjajxZqf4okNyvy5ufcOheGftMWJDAYRI X-Received: by 2002:a17:906:9acc:: with SMTP id ah12mr40762291ejc.386.1609168402914; Mon, 28 Dec 2020 07:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168402; cv=none; d=google.com; s=arc-20160816; b=cmWeBehytt+pw+f0Z5OO44jPrDFORZhdjzuf70ZbVUjvtsHjPc/QPX7SM09VG/AWNG FtKrNACFobVntdKqeojL9uDU7CN3J9HBh4wXz73hM8rkQSzHGnVe8XEu8Yu9BvDhijNG 94+YHu6oj7i45JuNoptO+NyWSVw70Cw2l+0jQYuxAikqYnMAB3MtK1mDGI4xpwT0FxoM xFM5VZX+oJ2q456BeuZi22fntWoYMRvBoMhzK3LYgffEQmYuk3ji0UsIYCnxLpRgkx6I 28EtkNMdI/RhkC12kBaY2K3KQ9u2Y88MLlywpKiHAApEH6RdkhoXvkZOHo1v2aZFjcCw zSLw== 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=M4gYRKNAIC6+EKL6eMszcU+yVqEXkSt6P3R55eqNGbQ=; b=YOv5iw8VuEPPTiDuQWuEprH8g+aMmmnPDVkycgtTlEdVITA3UP6hTTY12av9Wi2fjY E2MLDOA/bd9q6DDssewPP2U/V88ONzhJE4cmah8z97u7vid7hdzlTHjLe8g2AKYGax+J 9eZKinE4LFIewcCn09T6YYGu+b13KJael//UaEUCly+vgS3qgAb6igXFdEHIdN0jk+eu WXCA35EzRw6oNp24Iq/1KpHz0NstO35qIP7OCcp5yp/AdNcx8J3BWYZe57ezC5jhROW9 970LHFGg2HBRRz8xHTKEo+AQkA7YFiBrV0ltpXolhvXZu6fRyWgJhz3Ups0DKfA7xsjK XaOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AXZacnVA; 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 fy14si18585077ejb.227.2020.12.28.07.12.58; Mon, 28 Dec 2020 07:13:22 -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=AXZacnVA; 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 S2440816AbgL1PKe (ORCPT + 99 others); Mon, 28 Dec 2020 10:10:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:41626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438458AbgL1OHb (ORCPT ); Mon, 28 Dec 2020 09:07:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 37DA6207BC; Mon, 28 Dec 2020 14:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164435; bh=vTFfNL77Rq31JNEYvSOY56B3lMMKjcYx11cGGL6awqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXZacnVAVK5ChQdXl4n3uGHqNRIGoSYdwTubBCh549HeBkkptHvAXLc3lrDIHtfSn c1jgxEf4nsSybZ2heeCQBDW5HKzJD6Gnu2YWsvGONXrzknM5QuyhZ6kSWR8g+G4oSP RfVghG2j4JXH/2dsy0a/FygWdEidgk7WW3tjDins= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.10 149/717] Input: ads7846 - fix unaligned access on 7845 Date: Mon, 28 Dec 2020 13:42:27 +0100 Message-Id: <20201228125028.102332804@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 78ed285c27ae3..ff97897feaf2a 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -33,6 +33,7 @@ #include #include #include +#include /* * This code has been heavily tested on a Nokia 770, and lightly @@ -435,7 +436,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