Linus,
Tim and I come to you hand-in-hand with a patch to Space.c.
It does the following:
- Arranges for the eight "eth%d" and "tr%d" strings to be generated
separately, rather than commoned up by the compiler.
- Arranges for said strings to be placed in .data, not .rodata
- Correctly pads all these overwritable strings out to length IFNAMSIZ
with trailing nulls.
A patch against 2.3.99-pre4-1 is attached.
Tim Waugh wrote:
>
> On Wed, 5 Apr 2000, Andrew Morton wrote:
>
> > I've sent you a patch direct, plus a little script which compiles
> > Space.c with everything enabled. Please cast an eye across it.
>
> Looks good.
-- -akpm-
--- linux-2.3.99-pre3/drivers/net/Space.c Thu Mar 30 17:08:50 2000 +++ linux-akpm/drivers/net/Space.c Wed Apr 5 18:11:31 2000 @@ -486,7 +486,7 @@ #endif -/* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is tring of 9 zeros. */ +/* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is a string of 9 zeros. */ #define __PAD6 "\0\0\0\0\0\0\0\0\0" #define __PAD5 __PAD6 "\0" #define __PAD4 __PAD5 "\0" @@ -561,23 +561,32 @@ #define ETH_NOPROBE_ADDR 0xffe0 +static char ethd_7[] = "eth%d" __PAD5; +static char ethd_6[] = "eth%d" __PAD5; +static char ethd_5[] = "eth%d" __PAD5; +static char ethd_4[] = "eth%d" __PAD5; +static char ethd_3[] = "eth%d" __PAD5; +static char ethd_2[] = "eth%d" __PAD5; +static char ethd_1[] = "eth%d" __PAD5; +static char ethd_0[] = "eth%d" __PAD5; + static struct net_device eth7_dev = { - "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe }; + ethd_7, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe }; static struct net_device eth6_dev = { - "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð7_dev, ethif_probe }; + ethd_6, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð7_dev, ethif_probe }; static struct net_device eth5_dev = { - "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð6_dev, ethif_probe }; + ethd_5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð6_dev, ethif_probe }; static struct net_device eth4_dev = { - "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð5_dev, ethif_probe }; + ethd_4, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð5_dev, ethif_probe }; static struct net_device eth3_dev = { - "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð4_dev, ethif_probe }; + ethd_3, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð4_dev, ethif_probe }; static struct net_device eth2_dev = { - "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð3_dev, ethif_probe }; + ethd_2, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð3_dev, ethif_probe }; static struct net_device eth1_dev = { - "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð2_dev, ethif_probe }; + ethd_1, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð2_dev, ethif_probe }; static struct net_device eth0_dev = { - "eth%d" __PAD5, 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev, ethif_probe }; + ethd_0, 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev, ethif_probe }; # undef NEXT_DEV # define NEXT_DEV (ð0_dev) @@ -608,22 +617,31 @@ } return 0; } +static char trd_7[] = "tr%d" __PAD4; +static char trd_6[] = "tr%d" __PAD4; +static char trd_5[] = "tr%d" __PAD4; +static char trd_4[] = "tr%d" __PAD4; +static char trd_3[] = "tr%d" __PAD4; +static char trd_2[] = "tr%d" __PAD4; +static char trd_1[] = "tr%d" __PAD4; +static char trd_0[] = "tr%d" __PAD4; + static struct net_device tr7_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, NEXT_DEV, trif_probe }; + trd_7,0,0,0,0,0,0,0,0,0, NEXT_DEV, trif_probe }; static struct net_device tr6_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr7_dev, trif_probe }; + trd_6,0,0,0,0,0,0,0,0,0, &tr7_dev, trif_probe }; static struct net_device tr5_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr6_dev, trif_probe }; + trd_5,0,0,0,0,0,0,0,0,0, &tr6_dev, trif_probe }; static struct net_device tr4_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr5_dev, trif_probe }; + trd_4,0,0,0,0,0,0,0,0,0, &tr5_dev, trif_probe }; static struct net_device tr3_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr4_dev, trif_probe }; + trd_3,0,0,0,0,0,0,0,0,0, &tr4_dev, trif_probe }; static struct net_device tr2_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr3_dev, trif_probe }; + trd_2,0,0,0,0,0,0,0,0,0, &tr3_dev, trif_probe }; static struct net_device tr1_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr2_dev, trif_probe }; + trd_1,0,0,0,0,0,0,0,0,0, &tr2_dev, trif_probe }; static struct net_device tr0_dev = { - "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr1_dev, trif_probe }; + trd_0,0,0,0,0,0,0,0,0,0, &tr1_dev, trif_probe }; # undef NEXT_DEV # define NEXT_DEV (&tr0_dev) @@ -653,9 +671,9 @@ #ifdef CONFIG_NET_FC static struct net_device fc1_dev = { - "fc1", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, fcif_probe}; + "fc1" __PAD3, 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, fcif_probe}; static struct net_device fc0_dev = { - "fc0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fc1_dev, fcif_probe}; + "fc0" __PAD3, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fc1_dev, fcif_probe}; # undef NEXT_DEV # define NEXT_DEV (&fc0_dev) #endif @@ -663,21 +681,21 @@ #ifdef CONFIG_SBNI static struct net_device sbni7_dev = - {"sbni7", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sbni_probe}; + {"sbni7" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sbni_probe}; static struct net_device sbni6_dev = - {"sbni6", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni7_dev, sbni_probe}; + {"sbni6" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni7_dev, sbni_probe}; static struct net_device sbni5_dev = - {"sbni5", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni6_dev, sbni_probe}; + {"sbni5" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni6_dev, sbni_probe}; static struct net_device sbni4_dev = - {"sbni4", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni5_dev, sbni_probe}; + {"sbni4" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni5_dev, sbni_probe}; static struct net_device sbni3_dev = - {"sbni3", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni4_dev, sbni_probe}; + {"sbni3" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni4_dev, sbni_probe}; static struct net_device sbni2_dev = - {"sbni2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni3_dev, sbni_probe}; + {"sbni2" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni3_dev, sbni_probe}; static struct net_device sbni1_dev = - {"sbni1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni2_dev, sbni_probe}; + {"sbni1" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni2_dev, sbni_probe}; static struct net_device sbni0_dev = - {"sbni0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni1_dev, sbni_probe}; + {"sbni0" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni1_dev, sbni_probe}; #undef NEXT_DEV #define NEXT_DEV (&sbni0_dev) @@ -692,7 +710,7 @@ extern int loopback_init(struct net_device *dev); struct net_device loopback_dev = - {"lo", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, loopback_init}; + {"lo" __PAD2, 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, loopback_init}; struct net_device *dev_base = &loopback_dev; rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:14 EST