From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752843AbcLKAOO (ORCPT ); Sat, 10 Dec 2016 19:14:14 -0500 Received: from avasout05.plus.net ([84.93.230.250]:42353 "EHLO avasout05.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbcLKAOM (ORCPT ); Sat, 10 Dec 2016 19:14:12 -0500 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.2 cv=Qskc5h6d c=1 sm=1 tr=0 a=o7Djd4SkmPXITDn8qH+ssQ==:117 a=o7Djd4SkmPXITDn8qH+ssQ==:17 a=kj9zAlcOel0A:10 a=n5n_aSjo0skA:10 a=lCC88NpSyBCAmAj0O-UA:9 a=48JNWf9fvm8_kZNf:21 a=3MOnBtvjp7D0pQ1t:21 a=CjuIK1q_8ugA:10 Date: Sun, 11 Dec 2016 00:14:08 +0000 From: Nick Dyer To: Dmitry Torokhov Cc: Andrew Duggan , Chris Healy , Henrik Rydberg , Benjamin Tissoires , Linus Walleij , Bjorn Andersson , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8] Input: synaptics-rmi4 - add support for F34 V7 bootloader Message-ID: <20161211001408.GA2327@lava.h.shmanahar.org> References: <1480899769-31330-1-git-send-email-nick@shmanahar.org> <20161208021418.GD27638@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161208021418.GD27638@dtor-ws> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 07, 2016 at 06:14:18PM -0800, Dmitry Torokhov wrote: > On Mon, Dec 05, 2016 at 01:02:49AM +0000, Nick Dyer wrote: > > +static void rmi_f34v7_parse_img_header_10_bl_container(struct f34_data *f34, > > + const u8 *image) > > +{ > > + int i; > > + u8 num_of_containers; > > + unsigned int addr; > > + unsigned int container_id; > > + unsigned int length; > > + const u8 *content; > > + struct container_descriptor *descriptor; > > + > > + BUG_ON(f34->v7.img.bootloader.size < 4); > > + > > + num_of_containers = (f34->v7.img.bootloader.size - 4) / 4; > > + > > + for (i = 1; i <= num_of_containers; i++) { > > + addr = le32_to_cpu(f34->v7.img.bootloader.data + (i * 4)); > > This cannot possibly be right. "f34->v7.img.bootloader.data + (i * 4)" > is a pointer in memory, you should not be converting it from le32. > > Did you mean to use le32_to_cpup((__le32 *)(f34->v7.img.bootloader.data > + (i * 4))) ? You're quit right. It should be get_unaligned_le32() to read an offset address from the firmware image. Will be fixed in v9. Nick