From patchwork Tue Feb 24 07:54:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 23606 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 72CDCDDDA9 for ; Tue, 24 Feb 2009 18:55:34 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752682AbZBXHza (ORCPT ); Tue, 24 Feb 2009 02:55:30 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752656AbZBXHza (ORCPT ); Tue, 24 Feb 2009 02:55:30 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:61499 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752407AbZBXHz3 (ORCPT ); Tue, 24 Feb 2009 02:55:29 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 118AF170166; Tue, 24 Feb 2009 16:07:03 +0800 (CST) Received: from fnst.cn.fujitsu.com (localhost.localdomain [127.0.0.1]) by tang.cn.fujitsu.com (8.13.1/8.13.1) with ESMTP id n1O7u5qU028711; Tue, 24 Feb 2009 15:56:05 +0800 Received: from [127.0.0.1] (unknown [10.167.141.76]) by fnst.cn.fujitsu.com (Postfix) with ESMTP id 09A10DC345; Tue, 24 Feb 2009 15:55:32 +0800 (CST) Message-ID: <49A3A7D3.8080508@cn.fujitsu.com> Date: Tue, 24 Feb 2009 15:54:59 +0800 From: Wei Yongjun User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: David Miller CC: netdev@vger.kernel.org Subject: [PATCH 2/3] ipip: used time_before for comparing jiffies Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The functions time_before is more robust for comparing jiffies against other values. Signed-off-by: Wei Yongjun --- net/ipv4/ipip.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) } else diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 5079dfb..4b50199 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -327,7 +327,7 @@ static int ipip_err(struct sk_buff *skb, u32 info) if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) goto out; - if (jiffies - t->err_time < IPTUNNEL_ERR_TIMEO) + if (time_before(jiffies, t->err_time + IPTUNNEL_ERR_TIMEO)) t->err_count++; else t->err_count = 1; @@ -466,7 +466,8 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) } if (tunnel->err_count > 0) { - if (jiffies - tunnel->err_time < IPTUNNEL_ERR_TIMEO) { + if (time_before(jiffies, + tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { tunnel->err_count--; dst_link_failure(skb);