public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH] mach-snapdragon: Fix overwriting last digit of serial number
Date: Fri, 20 Mar 2020 13:31:13 -0400	[thread overview]
Message-ID: <20200320173113.GC5793@bill-the-cat> (raw)
In-Reply-To: <CAOn6aLKf4c3==Sm_cx1Ch602pMer97_2rBet9uY2YUQXvSqcWg@mail.gmail.com>

On Mon, Mar 16, 2020 at 05:51:51PM +0100, Jan-Christoph Tebbe wrote:

> When generating the MAC address based on the boards serial number
> the last digit was overwritten with the null termination. That way
> boards with serial numbers close to each other would use the same
> MAC address.
> 
> Signed-off-by: Jan-Christoph Tebbe <Jan-Christoph.Tebbe@ithinx.io>
> ---
>  arch/arm/mach-snapdragon/misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-snapdragon/misc.c b/arch/arm/mach-snapdragon/misc.c
> index f6c87866c0..aaa561c2c6 100644
> --- a/arch/arm/mach-snapdragon/misc.c
> +++ b/arch/arm/mach-snapdragon/misc.c
> @@ -41,7 +41,7 @@ void msm_generate_mac_addr(u8 *mac)
>   int i;
>   char sn[9];
> 
> - snprintf(sn, 8, "%08x", msm_board_serial());
> + snprintf(sn, 9, "%08x", msm_board_serial());
> 
>   /* fill in the mac with serialno, use locally adminstrated pool */
>   mac[0] = 0x02;

OK, so sn is size 9 and now you're filling the whole thing.  Why don't
we need to increase sn to size 10?  Am I missing something?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200320/5b24283c/attachment.sig>

  reply	other threads:[~2020-03-20 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 16:51 [PATCH] mach-snapdragon: Fix overwriting last digit of serial number Jan-Christoph Tebbe
2020-03-20 17:31 ` Tom Rini [this message]
2020-04-01 10:18   ` Jan-Christoph Tebbe
2020-04-05 23:04 ` Tom Rini

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=20200320173113.GC5793@bill-the-cat \
    --to=trini@konsulko.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