From patchwork Mon Sep 6 12:26:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 63918 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.180.67]) by ozlabs.org (Postfix) with ESMTP id B3E0BB70F2 for ; Mon, 6 Sep 2010 22:27:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752333Ab0IFM1v (ORCPT ); Mon, 6 Sep 2010 08:27:51 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:52620 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975Ab0IFM1u (ORCPT ); Mon, 6 Sep 2010 08:27:50 -0400 Received: by wyf22 with SMTP id 22so2890441wyf.19 for ; Mon, 06 Sep 2010 05:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=3WPojaWkytLQIWu9a9XmxFvcrV8BXQMOHtyFHSz05Gc=; b=fkbEQeam042QeECrvaLDqHUJgJb4DmmeejnTlq4wgWApBQHJUHlqZtCUMDrTCxafqF jtyXx/nTJTThBbSc5e+Bh3khr2r2lJeVWB6fsK7LeThTPBwlWT9ixlWEcM+s1774JDPy vWH/B/UexAOAXMlw8257xldM41hNXGxl5bPvU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=uv7oRIgU6X/6R8dNmLjo52vhaENf2AGPQeKSQpxdpyxklHeLcC0E4EVY3y9RVvvwuZ oLnpOUAO0Y/aB6eqOuE1nbemZFFsD9GyIXr6ZZewkdrg/VAb6RhmvxLWkpMKIIi8essb UkeCthUS4QWTUHgoreUiFkTP6xy+W9v/utLX0= Received: by 10.227.134.138 with SMTP id j10mr1457385wbt.207.1283776065729; Mon, 06 Sep 2010 05:27:45 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id l55sm3300978weq.17.2010.09.06.05.27.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 06 Sep 2010 05:27:43 -0700 (PDT) Date: Mon, 6 Sep 2010 14:26:39 +0200 From: Dan Carpenter To: Vlad Yasevich Cc: Sridhar Samudrala , "David S. Miller" , Wei Yongjun , Thadeu Lima de Souza Cascardo , linux-sctp@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] sctp: fix test for end of loop Message-ID: <20100906122344.GA2764@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org "new_addr" is the list cursor here and it's always non-NULL. We're trying to test if we exited because the loop ended or we hit the break statement. Really testing !found is enough so long as "new_asoc->peer.transport_addr_list" is not empty and I believe it never is empty at this point. So this is never really a bug with the current code. Signed-off-by: Dan Carpenter --- Compile tested only. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 24b2cd5..cb76d2e 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -1254,7 +1254,6 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc, /* Search through all current addresses and make sure * we aren't adding any new ones. */ - new_addr = NULL; found = 0; list_for_each_entry(new_addr, &new_asoc->peer.transport_addr_list, @@ -1273,7 +1272,8 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc, } /* If a new address was added, ABORT the sender. */ - if (!found && new_addr) { + if (!found && + &new_addr->transports != &new_asoc->peer.transport_addr_list) { sctp_sf_send_restart_abort(&new_addr->ipaddr, init, commands); }