* [U-Boot-Users] parse bug in cmd_mii.c
@ 2005-06-13 17:06 Andrew Dyer
2006-03-12 1:22 ` Wolfgang Denk
2006-07-22 18:39 ` [U-Boot-Users] " Wolfgang Denk
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Dyer @ 2005-06-13 17:06 UTC (permalink / raw)
To: u-boot
I noticed that in do_mii() the code is dereferencing argv[1] without
checking what value argc has. This leads to an exception if a command
line like 'mii ' is given where argv[1] is NULL.
I have a patch, but my cmd_mii.c is carrying around some other patches
(some submitted to the list, some local). Is there a good way to
separate out the patches I want to submit by themselves?
--
Hardware, n.:
The parts of a computer system that can be kicked.
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot-Users] parse bug in cmd_mii.c 2005-06-13 17:06 [U-Boot-Users] parse bug in cmd_mii.c Andrew Dyer @ 2006-03-12 1:22 ` Wolfgang Denk 2006-03-12 3:50 ` [U-Boot-Users] " Andrew Dyer 2006-07-22 18:39 ` [U-Boot-Users] " Wolfgang Denk 1 sibling, 1 reply; 5+ messages in thread From: Wolfgang Denk @ 2006-03-12 1:22 UTC (permalink / raw) To: u-boot In message <c166aa9f0506131006ba8f552@mail.gmail.com> you wrote: > I noticed that in do_mii() the code is dereferencing argv[1] without > checking what value argc has. This leads to an exception if a command > line like 'mii ' is given where argv[1] is NULL. > > I have a patch, but my cmd_mii.c is carrying around some other patches > (some submitted to the list, some local). Is there a good way to > separate out the patches I want to submit by themselves? Did I miss it, or did you never send a patch for the problem you mentioned? Best regards, Wolfgang Denk -- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "'Tis true, 'tis pity, and pity 'tis 'tis true." - Poloniouius, in Willie the Shake's _Hamlet, Prince of Darkness_ ^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Re: parse bug in cmd_mii.c 2006-03-12 1:22 ` Wolfgang Denk @ 2006-03-12 3:50 ` Andrew Dyer 2006-03-12 3:56 ` Andrew Dyer 0 siblings, 1 reply; 5+ messages in thread From: Andrew Dyer @ 2006-03-12 3:50 UTC (permalink / raw) To: u-boot Sorry, it looks like I never sent it in. Here goes: CHANGELOG * entering 'mii' with no arguments causes a null pointer reference. Check argc is >=2 before dereferencing argv[1]. Print the usage message if not. Patch by Andrew Dyer <amdyer@gmail.com>, Sat Mar 11 21:42:12 CST 2006 Signed-off-by: Andrew Dyer <amdyer@gmail.com> Index: cmd_mii.c =================================================================== RCS file: /home/cvsroot/Projects/u-boot/common/cmd_mii.c,v retrieving revision 1.1.1.5 retrieving revision 1.8 diff -u -r1.1.1.5 -r1.8 --- cmd_mii.c 7 Feb 2006 09:51:23 -0000 1.1.1.5 +++ cmd_mii.c 12 Mar 2006 03:33:56 -0000 1.8 @@ -61,6 +61,11 @@ mii_init (); #endif + if (argc < 2) { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } + /* * We use the last specified parameters, unless new ones are * entered. @@ -438,6 +443,11 @@ #ifdef CONFIG_8xx mii_init (); #endif + + if (argc < 2) { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } /* * We use the last specified parameters, unless new ones are On 3/11/06, Wolfgang Denk <wd@denx.de> wrote: > In message <c166aa9f0506131006ba8f552@mail.gmail.com> you wrote: > > I noticed that in do_mii() the code is dereferencing argv[1] without > > checking what value argc has. This leads to an exception if a command > > line like 'mii ' is given where argv[1] is NULL. > > > > I have a patch, but my cmd_mii.c is carrying around some other patches > > (some submitted to the list, some local). Is there a good way to > > separate out the patches I want to submit by themselves? > > Did I miss it, or did you never send a patch for the problem you > mentioned? > > > Best regards, > > Wolfgang Denk > > -- > Software Engineering: Embedded and Realtime Systems, Embedded Linux > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de > "'Tis true, 'tis pity, and pity 'tis 'tis true." > - Poloniouius, in Willie the Shake's _Hamlet, Prince of Darkness_ > -- Hardware, n.: The parts of a computer system that can be kicked. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Re: parse bug in cmd_mii.c 2006-03-12 3:50 ` [U-Boot-Users] " Andrew Dyer @ 2006-03-12 3:56 ` Andrew Dyer 0 siblings, 0 replies; 5+ messages in thread From: Andrew Dyer @ 2006-03-12 3:56 UTC (permalink / raw) To: u-boot CHANGELOG * When looping over the PHY register address for the mii info command, loop exit count is incorrect in the CONFIG_TERSE_MII version of do_mii(). Patch by Andrew Dyer <amdyer@gmail.com>, Sat Mar 11 21:54:52 CST 2006 Signed-off-by: Andrew Dyer <amdyer@gmail.com> Index: cmd_mii.c =================================================================== RCS file: /home/cvsroot/Projects/u-boot/common/cmd_mii.c,v retrieving revision 1.1.1.5 retrieving revision 1.8 diff -u -r1.1.1.5 -r1.8 --- cmd_mii.c 7 Feb 2006 09:51:23 -0000 1.1.1.5 +++ cmd_mii.c 12 Mar 2006 03:33:56 -0000 1.8 @@ -101,7 +106,7 @@ start = 0; end = 31; } - for (j = start; j < end; j++) { + for (j = start; j <= end; j++) { if (miiphy_info (devname, j, &oui, &model, &rev) == 0) { printf ("PHY 0x%02X: " "OUI = 0x%04X, " -- Hardware, n.: The parts of a computer system that can be kicked. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] parse bug in cmd_mii.c 2005-06-13 17:06 [U-Boot-Users] parse bug in cmd_mii.c Andrew Dyer 2006-03-12 1:22 ` Wolfgang Denk @ 2006-07-22 18:39 ` Wolfgang Denk 1 sibling, 0 replies; 5+ messages in thread From: Wolfgang Denk @ 2006-07-22 18:39 UTC (permalink / raw) To: u-boot In message <c166aa9f0506131006ba8f552@mail.gmail.com> you wrote: > I noticed that in do_mii() the code is dereferencing argv[1] without > checking what value argc has. This leads to an exception if a command > line like 'mii ' is given where argv[1] is NULL. Finxed. Thanks for pointing out. > I have a patch, but my cmd_mii.c is carrying around some other patches > (some submitted to the list, some local). Is there a good way to > separate out the patches I want to submit by themselves? This depends on the tools you use. git cherry piking comes to mind, or some of the git porcelains... Best regards, Wolfgang Denk -- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "One day," said a dull voice from down below, "I'm going to be back in form again and you're going to be very sorry you said that. For a very long time. I might even go so far as to make even more Time just for you to be sorry in." - Terry Pratchett, _Small Gods_ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-07-22 18:39 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-06-13 17:06 [U-Boot-Users] parse bug in cmd_mii.c Andrew Dyer 2006-03-12 1:22 ` Wolfgang Denk 2006-03-12 3:50 ` [U-Boot-Users] " Andrew Dyer 2006-03-12 3:56 ` Andrew Dyer 2006-07-22 18:39 ` [U-Boot-Users] " Wolfgang Denk
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox