public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] common/cmd_mii.c: Add sanity argc check
Date: Thu, 27 Dec 2007 15:56:35 +0900	[thread overview]
Message-ID: <47734CA3.9020803@necel.com> (raw)
In-Reply-To: <477348BA.5090201@necel.com>

Shinya Kuribayashi 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@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

By the way, cmd_mii.c has _another_ do_mii() which is enabled for
CONFIG_TERSE_MII user. But it seems there is no CONFIG_TERSE_MII user.
I just wonder that do_mii() is in the transition to the newer version.

thanks,

  Shinya

  reply	other threads:[~2007-12-27  6:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-27  6:39 [U-Boot-Users] [PATCH] common/cmd_mii.c: Add sanity argc check Shinya Kuribayashi
2007-12-27  6:56 ` Shinya Kuribayashi [this message]
2007-12-27 13:43   ` gvb.uboot
2007-12-27 15:14 ` Andrew Dyer
2007-12-28  1:17   ` Shinya Kuribayashi
2007-12-28  3:43 ` [U-Boot-Users] [PATCH 1/2] cmd_mii.c: Fix a NULL pointer dereference Shinya Kuribayashi
2008-01-09 20:36 ` [U-Boot-Users] [PATCH] common/cmd_mii.c: Add sanity argc check Wolfgang Denk

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=47734CA3.9020803@necel.com \
    --to=shinya.kuribayashi@necel.com \
    --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