Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1538268 > unrolled thread

Re: [PATCH v8] Input: synaptics-rmi4 - add support for F34 V7 bootloader

Started byDmitry Torokhov <dmitry.torokhov@gmail.com>
First post2016-12-08 03:20 +0100
Last post2016-12-11 01:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v8] Input: synaptics-rmi4 - add support for F34 V7  bootloader Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-12-08 03:20 +0100
    Re: [PATCH v8] Input: synaptics-rmi4 - add support for F34 V7  bootloader Nick Dyer <nick@shmanahar.org> - 2016-12-11 01:20 +0100

#1538268 — Re: [PATCH v8] Input: synaptics-rmi4 - add support for F34 V7 bootloader

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2016-12-08 03:20 +0100
SubjectRe: [PATCH v8] Input: synaptics-rmi4 - add support for F34 V7 bootloader
Message-ID<sLWtr-8ph-9@gated-at.bofh.it>
Hi Nick,

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))) ?

Thanks.

-- 
Dmitry

[toc] | [next] | [standalone]


#1539934

FromNick Dyer <nick@shmanahar.org>
Date2016-12-11 01:20 +0100
Message-ID<sN01X-xv-5@gated-at.bofh.it>
In reply to#1538268
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web