mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Daniel Schultz <d.schultz@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] arm: imx6: ocotp: Added write check
Date: Wed, 30 Nov 2016 12:10:44 +0100	[thread overview]
Message-ID: <1480504245-1822-2-git-send-email-d.schultz@phytec.de> (raw)
In-Reply-To: <1480504245-1822-1-git-send-email-d.schultz@phytec.de>

Since it's forbidden to use a multicast address as ethernet address,
the driver should check the addresses before they got written.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 arch/arm/mach-imx/ocotp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
index 9efa46a..f8978c0 100644
--- a/arch/arm/mach-imx/ocotp.c
+++ b/arch/arm/mach-imx/ocotp.c
@@ -452,6 +452,12 @@ static int imx_ocotp_set_mac(unsigned int mac_no, struct param_d *param,
 	for (i = 0; i < 6; i++)
 		buf[5 - i + offset] = ocotp_priv->ethaddr[mac_no][i];
 
+	if (0x01 & buf[5 + offset]) {
+		dev_err(&ocotp_priv->dev,
+			"this MAC address is a broadcast/multicast\n");
+		return -EINVAL;
+	}
+
 	ret = regmap_bulk_write(ocotp_priv->map,
 				(mac_no == 0) ? MAC0_OFFSET : MAC1_OFFSET, buf,
 				MAC_BYTES);
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-11-30 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30 11:10 [PATCH 1/3] arm: imx6: ocotp: Added support for the i.MX6UL Daniel Schultz
2016-11-30 11:10 ` Daniel Schultz [this message]
2016-11-30 11:10 ` [PATCH 3/3] arm: dts: Added ocotp support for i.MX6UL Daniel Schultz
2016-11-30 16:38   ` Andrey Smirnov
2016-12-08  9:32     ` Daniel Schultz

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=1480504245-1822-2-git-send-email-d.schultz@phytec.de \
    --to=d.schultz@phytec.de \
    --cc=barebox@lists.infradead.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