linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Florian Fainelli <florian@openwrt.org>
Cc: linux-mtd@lists.infradead.org, Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH] mtd: add Broadcom BCM63xx image tag partition parser
Date: Mon, 25 Oct 2010 00:11:49 +0100	[thread overview]
Message-ID: <1287961909.5674.15.camel@macbook.infradead.org> (raw)
In-Reply-To: <201009121553.01374.florian@openwrt.org>

On Sun, 2010-09-12 at 15:52 +0200, Florian Fainelli wrote:
> 
> +       ret = master->read(master, master->erasesize, sizeof(struct bcm_tag),
> +                                                       &retlen, (void *)buf);
> +       if (retlen != sizeof(struct bcm_tag)) {
> +               vfree(buf);
> +               return -EIO;
> +       }
> +
> +       sscanf(buf->kernel_address, "%u", &kerneladdr);
> +       sscanf(buf->kernel_length, "%u", &kernellen);
> +       sscanf(buf->total_length, "%u", &totallen);
> +       tagversion = &(buf->tag_version[0]);
> +       boardid = &(buf->board_id[0]);
> +
> +       printk(KERN_INFO PFX "CFE boot tag found with version %s "
> +                               "and board type %s\n", tagversion, boardid); 

Um, that looks easy to crash, given that you aren't even checking the
CRC before you do this, and you aren't checking that any of these
strings are actually NUL-terminated.

I'm applying it as-is, since I'm extremely late -- I've been slacking.
But please could I have a fix?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

      parent reply	other threads:[~2010-10-24 23:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-12 13:52 [PATCH] mtd: add Broadcom BCM63xx image tag partition parser Florian Fainelli
2010-09-13  8:55 ` Artem Bityutskiy
2010-10-24 23:11 ` David Woodhouse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1287961909.5674.15.camel@macbook.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=dedekind1@gmail.com \
    --cc=florian@openwrt.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).