lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161211201631.GA5882@lava.h.shmanahar.org>
Date:   Sun, 11 Dec 2016 20:16:31 +0000
From:   Nick Dyer <nick@...anahar.org>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     Andrew Duggan <aduggan@...aptics.com>,
        Chris Healy <cphealy@...il.com>,
        Henrik Rydberg <rydberg@...math.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9] Input: synaptics-rmi4 - add support for F34 V7
 bootloader

On Sun, Dec 11, 2016 at 12:03:49AM -0800, Dmitry Torokhov wrote:
> On Sun, Dec 11, 2016 at 12:18:26AM +0000, Nick Dyer wrote:
> > +static void rmi_f34v7_parse_img_header_10_bl_container(struct f34_data *f34,
> > +						       const u8 *image)
> > +{
> > +	int i;
> > +	int 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);
> 
> Killing the box because you got bad firmware is not very nice...
> 
> > +
> > +	num_of_containers = (f34->v7.img.bootloader.size - 4) / 4;
> 
> Wouldn't
> 
> 	num_of_containes = f34->v7.img.bootloader.size / 4 - 1;
> 
> give the same result but be less "suspicious". The variable is 'int' so
> for size < 4 we'll get a negative and the loop won't execute.

Neat!

> > +
> > +	for (i = 1; i <= num_of_containers; i++) {
> > +		addr = get_unaligned_le32(f34->v7.img.bootloader.data + i*4);
> > +		descriptor = (struct container_descriptor *)(image + addr);
> 
> This casts away constness, which is not nice. DOes it still work if you
> apply the below on top?

I've run it through a few flash cycles with no issues.

Tested-by: Nick Dyer <nick@...anahar.org>

> Thanks!

Thanks for your help with this.

> 
> -- 
> Dmitry
> 
> 
> Input: synaptics-rmi4 - misc f34v7 changes
> 
> From: Dmitry Torokhov <dmitry.torokhov@...il.com>
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
>  drivers/input/rmi4/rmi_f34.h   |    6 ++--
>  drivers/input/rmi4/rmi_f34v7.c |   64 ++++++++++++++++------------------------
>  2 files changed, 28 insertions(+), 42 deletions(-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ