From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
linux-mips@linux-mips.org, Maxime Bizon <mbizon@freebox.fr>,
Florian Fainelli <florian@openwrt.org>
Subject: Re: [PATCH] MIPS: BCM63XX: properly handle mac address octet overflow
Date: Tue, 18 Sep 2012 15:51:53 +0400 [thread overview]
Message-ID: <50586059.4090407@mvista.com> (raw)
In-Reply-To: <1347960728-5884-1-git-send-email-jonas.gorski@gmail.com>
Hello.
On 18-09-2012 13:32, Jonas Gorski wrote:
> While calculating the mac address the pointer for the current octet was
> never reset back to the least significant one after being decremented
> because of an octet overflow. This resulted in the code continuing to
> increment at the current octet, potentially generating duplicate or
> invalid mac addresses.
> As a second issue the pointer was allowed to advance up to the most
> significant octet, modifying the OUI, and potentially changing the type
> of mac address.
> Rewrite the code so it resets the pointer to the least significant
> in each outer loop step, and bails out when the least significant octet
> of the OUI is reached.
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> ---
> arch/mips/bcm63xx/boards/board_bcm963xx.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
> diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
> index ea4ea77..f0fcec6 100644
> --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
> +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
> @@ -720,7 +720,7 @@ const char *board_get_name(void)
> */
> static int board_get_mac_address(u8 *mac)
> {
> - u8 *p;
> + u8 *oui;
> int count;
>
> if (mac_addr_used >= nvram.mac_addr_count) {
> @@ -729,21 +729,23 @@ static int board_get_mac_address(u8 *mac)
> }
>
> memcpy(mac, nvram.mac_addr_base, ETH_ALEN);
> - p = mac + ETH_ALEN - 1;
> + oui = mac + ETH_ALEN/2 - 1;
> count = mac_addr_used;
>
> while (count--) {
> + p = mac + ETH_ALEN - 1;
But didn't you remove 'p' above? Did you compile this?
WBR, Sergei
next prev parent reply other threads:[~2012-09-18 11:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-18 9:32 [PATCH] MIPS: BCM63XX: properly handle mac address octet overflow Jonas Gorski
2012-09-18 11:51 ` Sergei Shtylyov [this message]
2012-09-18 11:56 ` Jonas Gorski
2012-09-18 12:09 ` [PATCH V2] " Jonas Gorski
2012-09-23 17:34 ` Ralf Baechle
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=50586059.4090407@mvista.com \
--to=sshtylyov@mvista.com \
--cc=florian@openwrt.org \
--cc=jonas.gorski@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=mbizon@freebox.fr \
--cc=ralf@linux-mips.org \
/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