[patch] Space.c and -fwritable-strings

From: Tim Waugh (tim@cyberelk.demon.co.uk)
Date: Tue Apr 04 2000 - 13:17:02 EST


Here is a patch to compile Space.c with -fwritable-strings, so that
identical strings that will get overwritten don't all get put in the same
memory location.

I've also added padding to some interface names that didn't have it, for
completeness.

Tim.
*/

--- linux/drivers/net/Space.c~ Tue Apr 4 19:06:02 2000
+++ linux/drivers/net/Space.c Tue Apr 4 19:09:39 2000
@@ -653,9 +653,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 +663,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 +692,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;
--- linux/drivers/net/Makefile~ Tue Apr 4 19:04:44 2000
+++ linux/drivers/net/Makefile Tue Apr 4 19:05:51 2000
@@ -177,6 +177,7 @@
 obj-$(CONFIG_AIRONET4500_PROC) += aironet4500_proc.o
 obj-$(CONFIG_AIRONET4500_CS) += aironet4500_proc.o
 
+CFLAGS_Space.o := -fwritable-strings
 obj-$(CONFIG_NET) += Space.o setup.o net_init.o loopback.o
 obj-$(CONFIG_SEEQ8005) += seeq8005.o
 obj-$(CONFIG_ETHERTAP) += ethertap.o

-
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:12 EST