From patchwork Thu Jul 31 03:23:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Hecheng X-Patchwork-Id: 4653111 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4513FC033A for ; Thu, 31 Jul 2014 03:29:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FDCF2015E for ; Thu, 31 Jul 2014 03:29:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F211201BC for ; Thu, 31 Jul 2014 03:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756186AbaGaD3o (ORCPT ); Wed, 30 Jul 2014 23:29:44 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:42243 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1756099AbaGaD3n (ORCPT ); Wed, 30 Jul 2014 23:29:43 -0400 X-IronPort-AV: E=Sophos;i="5.00,999,1396972800"; d="scan'208";a="33996457" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 31 Jul 2014 11:26:53 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s6V3Te2o008703 for ; Thu, 31 Jul 2014 11:29:40 +0800 Received: from localhost.localdomain (10.167.226.111) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 31 Jul 2014 11:29:51 +0800 From: Gui Hecheng To: CC: Gui Hecheng Subject: [PATCH 1/3] btrfs-progs: init variables which are checked later in btrfs-property Date: Thu, 31 Jul 2014 11:23:42 +0800 Message-ID: <1406777024-7647-1-git-send-email-guihc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-Originating-IP: [10.167.226.111] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The local variable @object etc. in btrfs-property get/set functions are to be checked whether to be NULL or not, but the @parse_args() don't guarantee to assign a value to it, so it is better to init it to NULL. Signed-off-by: Gui Hecheng --- cmds-property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmds-property.c b/cmds-property.c index 9c4eb92..90c7603 100644 --- a/cmds-property.c +++ b/cmds-property.c @@ -389,7 +389,7 @@ static void parse_args(int argc, char **argv, static int cmd_get(int argc, char **argv) { int ret; - char *object; + char *object = NULL; char *name = NULL; int types = 0; @@ -413,9 +413,9 @@ static int cmd_get(int argc, char **argv) static int cmd_set(int argc, char **argv) { int ret; - char *object; - char *name; - char *value; + char *object = NULL; + char *name = NULL; + char *value = NULL; int types = 0; if (check_argc_min(argc, 4) || check_argc_max(argc, 6))