[U-Boot-Users] [PATCH] common/cmd_mii.c: Add sanity argc check

Andrew Dyer amdyer at gmail.com
Thu Dec 27 16:14:09 CET 2007


On Dec 27, 2007 12:39 AM, Shinya Kuribayashi
<shinya.kuribayashi at necel.com> wrote:
> If type mii command without arguments, we suffer from uninitialized argv[]
> entries; for example we MIPS get stuck by TLB error.
>
> Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi at necel.com>
> ---
>
>  common/cmd_mii.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/common/cmd_mii.c b/common/cmd_mii.c
> index b771322..b99bd06 100644
> --- a/common/cmd_mii.c
> +++ b/common/cmd_mii.c
> @@ -438,6 +438,11 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
>         int             rcode = 0;
>         char            *devname;
>
> +       if (argc < 2) {
> +               printf("Usage:\n%s\n", cmdtp->usage);
> +               return 1;
> +       }
> +
>  #if defined(CONFIG_8xx) || defined(CONFIG_MCF532x)
>         mii_init ();
>  #endif
>

This looks the same as one of the fixes I posted in this thread :
http://news.gmane.org/find-root.php?message_id=%3cc166aa9f0506131006ba8f552%40mail.gmail.com%3e

I thought that fix was in the tree for a long time :-(


-- 
Hardware, n.:
        The parts of a computer system that can be kicked.




More information about the U-Boot mailing list