public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] fs/fs.c - error handling needed?
Date: Mon, 07 Oct 2013 15:55:55 +0200	[thread overview]
Message-ID: <20131007135555.0922B380A63@gemini.denx.de> (raw)
In-Reply-To: <20131007121252.GS15917@bill-the-cat>

Dear Tom,

In message <20131007121252.GS15917@bill-the-cat> you wrote:
> 
> > 331         filename = argv[3];
> > 332         addr = simple_strtoul(argv[4], NULL, cmdline_base);
> > 333         bytes = simple_strtoul(argv[5], NULL, cmdline_base);
> > 334         if (argc >= 7)
> > 335                 pos = simple_strtoul(argv[6], NULL, cmdline_base);
> > 336         else
> > 337                 pos = 0;
> > 
> > 
> > Should we not perform at least minimal error checking, i. e. verify
> > that no garbage arguments have been passed to that function?
>
> Yes, we ought to.  If you don't pass fatwrite the right number of
> arguments we get data aborts, for example.

Well, this is not a problem here, in do_save():

...
325         if (argc < 6 || argc > 7)
326                 return CMD_RET_USAGE;
...

And are you sure of "fatwrite"?  This calls do_fat_fswrite(). and here
I also see some test:

...
 98         if (argc < 5)
 99                 return cmd_usage(cmdtp);
...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Men don't talk peace unless they're ready to back it up with war.
	-- Col. Green, "The Savage Curtain", stardate 5906.4

  reply	other threads:[~2013-10-07 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 19:49 [U-Boot] fs/fs.c - error handling needed? Wolfgang Denk
2013-10-07 12:12 ` Tom Rini
2013-10-07 13:55   ` Wolfgang Denk [this message]
2013-10-07 14:23     ` Tom Rini
2013-10-08 16:58 ` Simon Glass

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=20131007135555.0922B380A63@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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