From: Jerry Van Baren <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] common: nvedit to protect additional ethernet addresses Part 1/1
Date: Sat, 06 Dec 2008 21:53:02 -0500 [thread overview]
Message-ID: <493B3A8E.1010902@gmail.com> (raw)
In-Reply-To: <20081207004345.49FCF834B020@gemini.denx.de>
Wolfgang Denk wrote:
> Dear Stefan Althoefer,
>
> In message <ghc625$k37$1@ger.gmane.org> you wrote:
>> This patches cmd_nvedit to reject changes for "ethaddr." in addition to "ethaddr"
>> and "serial#". This is intendend to protect changes to additional ethernet
>> addresses (e.g. "ethernet1").
>
> The patch is bogus, as additional ethernet addrssses are eth1addr,
> eth2addr, etc. and not ethaddr1, etc.
>
>
> Also, please don't remove perfectly god comments.
>
> NAK.
>
> Best regards,
>
> Wolfgang Denk
Arrgh, I was thinking I was so clever with strncmp() and it turns out I
was being clever based on a totally bogus assumption (wrong format).
:-( I *hate* it when that happens.
The following should work for eth[0-9]+addr (untested):
int ethnum;
:
:
/* "eth[0-9]+addr" is always protected */
if ((sscanf(name, "eth%daddr", ðnum) == 1) &&
(ethnum < MAX_ETH_ADDRS))
protected = 1;
Notes:
* The "ethaddr" case is handled prior to the above snippet of code.
* I took out the added check "if (strlen (name) == 8)", I'm not sure why
that was in there, it would limit us to 10 ethernets. If extra
validation is desired, ethnum could be checked to be less than
MAX_ETH_ADDRS. On reflection, it seems like a good idea so I added it
above.
* This is somewhat better than the strncmp() trick because the sscanf()
will only convert digits.
gvb
next prev parent reply other threads:[~2008-12-07 2:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-04 12:28 [U-Boot] [PATCH] common: nvedit to protect additional ethernet addresses Part 1/1 stefan.althoefer at web.de
2008-12-04 12:46 ` Jerry Van Baren
2008-12-04 17:57 ` Ben Warren
2008-12-04 20:48 ` Jerry Van Baren
2008-12-05 21:22 ` Stefan Althoefer
2008-12-07 0:43 ` Wolfgang Denk
2008-12-07 2:53 ` Jerry Van Baren [this message]
2008-12-07 5:47 ` Ben Warren
2008-12-07 9:33 ` Wolfgang Denk
2008-12-07 13:31 ` Stefan Althoefer
2008-12-07 16:26 ` Wolfgang Denk
2008-12-07 18:54 ` Stefan Althoefer
2008-12-07 21:25 ` Wolfgang Denk
2008-12-07 23:52 ` Stefan Althoefer
2008-12-15 22:55 ` Wolfgang Denk
2008-12-16 21:34 ` Stefan Althoefer
2008-12-08 20:14 ` Jerry Van Baren
-- strict thread matches above, loose matches on Subject: below --
2008-12-04 20:06 Stefan Althöfer
2008-12-04 21:06 ` Ben Warren
2008-12-15 22:56 ` Wolfgang Denk
2008-12-16 19:15 ` Stefan Althoefer
2008-12-16 19:22 ` Ben Warren
2008-12-16 20:55 ` 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=493B3A8E.1010902@gmail.com \
--to=gvb.uboot@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.