From patchwork Tue Aug 27 21:05:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 2850351 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 16FDC9F495 for ; Tue, 27 Aug 2013 21:06:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42A9C20413 for ; Tue, 27 Aug 2013 21:06:20 +0000 (UTC) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 306512041D for ; Tue, 27 Aug 2013 21:06:19 +0000 (UTC) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r7RL6BwF015850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Aug 2013 21:06:12 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r7RL6Bms012683 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Aug 2013 21:06:11 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VEQSp-0001mA-3X; Tue, 27 Aug 2013 14:06:11 -0700 Received: from acsinet21.oracle.com ([141.146.126.237]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VEQRo-0001c4-Rm for ocfs2-devel@oss.oracle.com; Tue, 27 Aug 2013 14:05:08 -0700 Received: from userp1030.oracle.com (userp1030.oracle.com [156.151.31.80]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r7RL576m009512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 27 Aug 2013 21:05:08 GMT Received: from mail-ye0-f202.google.com (mail-ye0-f202.google.com [209.85.213.202]) by userp1030.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r7RL566g029427 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 27 Aug 2013 21:05:07 GMT Received: by mail-ye0-f202.google.com with SMTP id r9so559189yen.1 for ; Tue, 27 Aug 2013 14:05:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:subject:to:cc:from:date:mime-version :content-type:content-transfer-encoding:message-id; bh=3y+cGO9YmxZOytnaU+gNc4qm7Ll4+TFafd7spqXh4EU=; b=Ms7/ldovgmgBXyXaeYBj8TtLuMVEdU0Rp4Zc1Wc8cm0QSxJoIM/aqlHUlxDGoy90TI 4q/NP5JXC6+QrfXqBAUsEmtzbDtn5YsURdUcYL/1x61GTnV8SJn3X/dAUfSYhYGBSWGv hHJgQiiLo05acz5vNKBIozdqpOR+OzX8bWVQsQN7E19rnVF2zWdE0OaK59fuin5SfzuV XAQUOQ6YzDKI+VS7nmkgmECfN3Ny1khkHClnMvGgABSo5GTFN6IdqLZo2OLtMwJEz4Cf k8W4wbbRfuS8sw7+tM9Da1DsWPw7RFdtVdc+YpFyuyH/MlLOcFMVKnl9dqlrKN/gMEGA 3yzQ== X-Gm-Message-State: ALoCoQlE3fcuCWKH60+Bq9+VoRhUFpQ8QdUqzDWaHrCdYW/vMZm07s0mP0+ESqXLNYRcFBcy3hJw X-Received: by 10.236.115.198 with SMTP id e46mr9193511yhh.33.1377637506262; Tue, 27 Aug 2013 14:05:06 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id a49si1406226yhc.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 27 Aug 2013 14:05:06 -0700 (PDT) Received: from localhost.localdomain (akpm3.mtv.corp.google.com [172.17.131.127]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id A504B31C129; Tue, 27 Aug 2013 14:05:05 -0700 (PDT) To: ocfs2-devel@oss.oracle.com From: akpm@linux-foundation.org Date: Tue, 27 Aug 2013 14:05:05 -0700 MIME-Version: 1.0 Message-Id: <20130827210505.A504B31C129@corp2gmr1-1.hot.corp.google.com> X-Flow-Control-Info: class=Pass-to-MM reputation=ipRisk-All ip=209.85.213.202 ct-class=R6 ct-vol1=-86 ct-vol2=6 ct-vol3=5 ct-risk=62 ct-spam1=100 ct-spam2=15 ct-bulk=0 rcpts=1 size=1681 X-Sendmail-CM-Score: 0.00% X-Sendmail-CM-Analysis: v=2.1 cv=aehYw3Yt c=1 sm=1 tr=0 a=ha2FkVaTqKRmVR2yA6Pcxw==:117 a=4_v1OM3m6qQA:10 a=NEiEQogP1MkA:10 a=os2CZ2fo8YAA:10 a=Z4Rwk6OoAAAA:8 a=1XWaLZrsAAAA:8 a=yPCof4ZbAAAA:8 a=E10VBZ4R2KoA:10 a=i0EeH86SAAAA:8 a=IXr_WNlcAAAA:8 a=iox4zFpeAAAA:8 a=qdcz-7R9ShpmfX28HHsA:9 a=k2RYjPoVNyvYN4Zr:21 a=3-MleykGM22-aFSX:21 a=e4xtJxf3HDoA:10 a=hPjdaMEvmhQA:10 a=7DSvI1NPTFQA:10 a=T5ZRoNnfl4MA:10 a=n9GBPR9yFnkA:10 a=jbrJJM5MRmoA:10 X-Sendmail-CT-Classification: not spam X-Sendmail-CT-RefID: str=0001.0A090207.521D1483.0133, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Cc: mfasheh@suse.com Subject: [Ocfs2-devel] [patch 12/22] ocfs2: add missing return value check of ocfs2_get_clusters() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Joseph Qi Subject: ocfs2: add missing return value check of ocfs2_get_clusters() In ocfs2_attach_refcount_tree() and ocfs2_duplicate_extent_list(), if error occurs when calling ocfs2_get_clusters(), it will go with unexpected behavior as local variables p_cluster, num_clusters and ext_flags are declared without initialization. Signed-off-by: Joseph Qi Reviewed-by: Jie Liu Cc: Joel Becker Cc: Mark Fasheh Signed-off-by: Andrew Morton --- fs/ocfs2/refcounttree.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff -puN fs/ocfs2/refcounttree.c~ocfs2-add-missing-return-value-check-of-ocfs2_get_clusters fs/ocfs2/refcounttree.c --- a/fs/ocfs2/refcounttree.c~ocfs2-add-missing-return-value-check-of-ocfs2_get_clusters +++ a/fs/ocfs2/refcounttree.c @@ -3854,7 +3854,10 @@ static int ocfs2_attach_refcount_tree(st while (cpos < clusters) { ret = ocfs2_get_clusters(inode, cpos, &p_cluster, &num_clusters, &ext_flags); - + if (ret) { + mlog_errno(ret); + goto unlock; + } if (p_cluster && !(ext_flags & OCFS2_EXT_REFCOUNTED)) { ret = ocfs2_add_refcount_flag(inode, &di_et, &ref_tree->rf_ci, @@ -4025,7 +4028,10 @@ static int ocfs2_duplicate_extent_list(s while (cpos < clusters) { ret = ocfs2_get_clusters(s_inode, cpos, &p_cluster, &num_clusters, &ext_flags); - + if (ret) { + mlog_errno(ret); + goto out; + } if (p_cluster) { ret = ocfs2_add_refcounted_extent(t_inode, &et, ref_ci, ref_root_bh,