From patchwork Fri Jul 27 10:34:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nageswara R Sastry X-Patchwork-Id: 1248361 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 92DABDFFBF for ; Fri, 27 Jul 2012 10:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753088Ab2G0KeG (ORCPT ); Fri, 27 Jul 2012 06:34:06 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:39749 "EHLO e06smtp16.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751528Ab2G0KeE (ORCPT ); Fri, 27 Jul 2012 06:34:04 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Jul 2012 11:34:01 +0100 Received: from d06nrmr1507.portsmouth.uk.ibm.com (9.149.38.233) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 27 Jul 2012 11:33:58 +0100 Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6RAXvoN2773138 for ; Fri, 27 Jul 2012 11:33:57 +0100 Received: from d06av12.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6RAXvex024598 for ; Fri, 27 Jul 2012 04:33:57 -0600 Received: from nasastry-1.boeblingen.de.ibm.com (nasastry-1.in.ibm.com [9.124.31.240]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6RAXuq9024576; Fri, 27 Jul 2012 04:33:56 -0600 From: Nageswara R Sastry To: linux-btrfs@vger.kernel.org Cc: chandanrmail@gmail.com Subject: [PATCH] btrfs-progs: btrfs-image.c: Added NULL pointer check. Date: Fri, 27 Jul 2012 16:04:14 +0530 Message-Id: <1343385254-8299-1-git-send-email-nasastry@in.ibm.com> X-Mailer: git-send-email 1.7.11.1 x-cbid: 12072710-3548-0000-0000-000002AB835C Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Check for the return value of 'open_ctree()' before dereferencing it. Signed-off-by: Nageswara R Sastry --- btrfs-image.c | 1 + 1 file changed, 1 insertion(+) diff --git a/btrfs-image.c b/btrfs-image.c index f2bbcc8..2a33a55 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, int num_threads, int ret; root = open_ctree(input, 0, 0); + BUG_ON(!root); BUG_ON(root->nodesize != root->leafsize); ret = metadump_init(&metadump, root, out, num_threads,