1 From 855094d7e46eb14c597ca09631cf95a92909982d Mon Sep 17 00:00:00 2001
2 From: Ilia Mirkin <imirkin@alum.mit.edu>
3 Date: Fri, 6 Dec 2013 18:56:53 -0500
4 Subject: [PATCH] MIPS: BCM47XX: Fix some very confused types and data
7 Fix nvram_read_alpha2 copying too many bytes over the ssb_sprom
8 structure. Also fix the arguments of the read_macaddr, although the code
9 was technically not wrong before due to an extra dereference.
11 Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
12 Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
13 Acked-by: John Crispin <blogic@openwrt.org>
14 Patchwork: http://patchwork.linux-mips.org/patch/6211/
16 arch/mips/bcm47xx/sprom.c | 18 +++++++++---------
17 1 file changed, 9 insertions(+), 9 deletions(-)
19 --- a/arch/mips/bcm47xx/sprom.c
20 +++ b/arch/mips/bcm47xx/sprom.c
21 @@ -135,7 +135,7 @@ static void nvram_read_leddc(const char
24 static void nvram_read_macaddr(const char *prefix, const char *name,
25 - u8 (*val)[6], bool fallback)
26 + u8 val[6], bool fallback)
30 @@ -144,11 +144,11 @@ static void nvram_read_macaddr(const cha
34 - bcm47xx_nvram_parse_macaddr(buf, *val);
35 + bcm47xx_nvram_parse_macaddr(buf, val);
38 static void nvram_read_alpha2(const char *prefix, const char *name,
39 - char (*val)[2], bool fallback)
40 + char val[2], bool fallback)
44 @@ -162,7 +162,7 @@ static void nvram_read_alpha2(const char
45 pr_warn("alpha2 is too long %s\n", buf);
48 - memcpy(val, buf, sizeof(val));
49 + memcpy(val, buf, 2);
52 static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
53 @@ -181,7 +181,7 @@ static void bcm47xx_fill_sprom_r1234589(
55 nvram_read_s8(prefix, NULL, "ag1", &sprom->antenna_gain.a1, 0,
57 - nvram_read_alpha2(prefix, "ccode", &sprom->alpha2, fallback);
58 + nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback);
61 static void bcm47xx_fill_sprom_r12389(struct ssb_sprom *sprom,
62 @@ -634,20 +634,20 @@ static void bcm47xx_fill_sprom_path_r45(
63 static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
64 const char *prefix, bool fallback)
66 - nvram_read_macaddr(prefix, "et0macaddr", &sprom->et0mac, fallback);
67 + nvram_read_macaddr(prefix, "et0macaddr", sprom->et0mac, fallback);
68 nvram_read_u8(prefix, NULL, "et0mdcport", &sprom->et0mdcport, 0,
70 nvram_read_u8(prefix, NULL, "et0phyaddr", &sprom->et0phyaddr, 0,
73 - nvram_read_macaddr(prefix, "et1macaddr", &sprom->et1mac, fallback);
74 + nvram_read_macaddr(prefix, "et1macaddr", sprom->et1mac, fallback);
75 nvram_read_u8(prefix, NULL, "et1mdcport", &sprom->et1mdcport, 0,
77 nvram_read_u8(prefix, NULL, "et1phyaddr", &sprom->et1phyaddr, 0,
80 - nvram_read_macaddr(prefix, "macaddr", &sprom->il0mac, fallback);
81 - nvram_read_macaddr(prefix, "il0macaddr", &sprom->il0mac, fallback);
82 + nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback);
83 + nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback);
86 static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix,