From patchwork Tue Feb 26 21:50:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 2187611 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E1DA1DF215 for ; Tue, 26 Feb 2013 21:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756634Ab3BZVu1 (ORCPT ); Tue, 26 Feb 2013 16:50:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3807 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753053Ab3BZVu0 (ORCPT ); Tue, 26 Feb 2013 16:50:26 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1QLoNlC017436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Feb 2013 16:50:23 -0500 Received: from liberator.sandeen.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1QLoMCu024246 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 26 Feb 2013 16:50:23 -0500 Message-ID: <512D2E1E.40102@redhat.com> Date: Tue, 26 Feb 2013 15:50:22 -0600 From: Eric Sandeen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130216 Thunderbird/17.0.3 MIME-Version: 1.0 To: Ilya Dryomov CC: kreijack@inwind.it, Goffredo Baroncelli , linux-btrfs@vger.kernel.org Subject: [PATCH 17/17 V3] btrfs-progs: initialize save_ptr prior to strtok_r References: <1361832890-40921-1-git-send-email-sandeen@redhat.com> <1361832890-40921-18-git-send-email-sandeen@redhat.com> <512D0325.5050308@gmail.com> <512D190E.2050002@redhat.com> <20130226204040.GA1993@zambezi.lan> <512D1F26.7020804@redhat.com> <20130226210742.GB1993@zambezi.lan> In-Reply-To: <20130226210742.GB1993@zambezi.lan> X-Enigmail-Version: 1.5 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The coverity runs had a false positive complaining that save_ptr is uninitialized in the call to strtok_r. Turns out that under the covers glibc was doing enough to confuse the checker about what was being called. Just to keep the noise down, do a harmless initialization, with a comment as to why. Signed-off-by: Eric Sandeen --- V3: Keep strtok_r for old compat, and just init the var. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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/cmds-balance.c b/cmds-balance.c index b671e1d..f5dc317 100644 --- a/cmds-balance.c +++ b/cmds-balance.c @@ -67,7 +67,7 @@ static int parse_one_profile(const char *profile, u64 *flags) static int parse_profiles(char *profiles, u64 *flags) { char *this_char; - char *save_ptr; + char *save_ptr = NULL; /* Satisfy static checkers */ for (this_char = strtok_r(profiles, "|", &save_ptr); this_char != NULL; @@ -136,7 +136,7 @@ static int parse_filters(char *filters, struct btrfs_balance_args *args) { char *this_char; char *value; - char *save_ptr; + char *save_ptr = NULL; /* Satisfy static checkers */ if (!filters) return 0;