From owner-svn-src-all@FreeBSD.ORG Mon May 28 16:33:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1AA91065672; Mon, 28 May 2012 16:33:58 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D20C8FC0C; Mon, 28 May 2012 16:33:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4SGXwd6021818; Mon, 28 May 2012 16:33:58 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4SGXw51021816; Mon, 28 May 2012 16:33:58 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201205281633.q4SGXw51021816@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 28 May 2012 16:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236188 - head/sys/fs/nandfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2012 16:33:58 -0000 Author: marcel Date: Mon May 28 16:33:58 2012 New Revision: 236188 URL: http://svn.freebsd.org/changeset/base/236188 Log: Catch a corner case where ssegs could be 0 and thus i would be 0 and we index suinfo out of bounds (i.e. -1). Approved by: gber Modified: head/sys/fs/nandfs/nandfs_cleaner.c Modified: head/sys/fs/nandfs/nandfs_cleaner.c ============================================================================== --- head/sys/fs/nandfs/nandfs_cleaner.c Mon May 28 15:34:55 2012 (r236187) +++ head/sys/fs/nandfs/nandfs_cleaner.c Mon May 28 16:33:58 2012 (r236188) @@ -310,23 +310,22 @@ retry: nandfs_error("%s:%d", __FILE__, __LINE__); goto out; } - if (ssegs == 0 && *rseg != 0) { *rseg = 0; goto retry; } + if (ssegs > 0) { + print_suinfo(suinfo, ssegs); - print_suinfo(suinfo, ssegs); - - for (i = 0; i < ssegs; i++) { - (**segpp) = suinfo[i].nsi_num; - (*segpp)++; + for (i = 0; i < ssegs; i++) { + (**segpp) = suinfo[i].nsi_num; + (*segpp)++; + } + *rseg = suinfo[i - 1].nsi_num + 1; } - *rseg = suinfo[i - 1].nsi_num + 1; out: free(suinfo, M_NANDFSTEMP); - return (error); }