aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-15 01:08:28 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-15 01:08:28 -0500
commitcaf5b04c82f05c65843b2d7189845d6c3df5a41e (patch)
tree57543bd382f065b1e9c368669a2f723e0721383f /net/ipv4/fib_frontend.c
parent650eec5e04468d0611a60e6098464b7c43981552 (diff)
x86: Work around compiler code generation bug with -Os
Some versions of gcc generate incorrect code for the inet_check_attr() function, apparently due to a totally bogus index -> pointer comparison transformation. At least "gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)" from FC4 is affected, possibly others too. This changes the function subtly so that the buggy gcc transformation doesn't trigger. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 5b25fc0d980c..4e3d3811dea2 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -289,13 +289,13 @@ static int inet_check_attr(struct rtmsg *r, struct rtattr **rta)
289{ 289{
290 int i; 290 int i;
291 291
292 for (i=1; i<=RTA_MAX; i++) { 292 for (i=1; i<=RTA_MAX; i++, rta++) {
293 struct rtattr *attr = rta[i-1]; 293 struct rtattr *attr = *rta;
294 if (attr) { 294 if (attr) {
295 if (RTA_PAYLOAD(attr) < 4) 295 if (RTA_PAYLOAD(attr) < 4)
296 return -EINVAL; 296 return -EINVAL;
297 if (i != RTA_MULTIPATH && i != RTA_METRICS) 297 if (i != RTA_MULTIPATH && i != RTA_METRICS)
298 rta[i-1] = (struct rtattr*)RTA_DATA(attr); 298 *rta = (struct rtattr*)RTA_DATA(attr);
299 } 299 }
300 } 300 }
301 return 0; 301 return 0;