From patchwork Wed Oct 5 13:03:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasanth KSR X-Patchwork-Id: 9362875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF7E96077E for ; Wed, 5 Oct 2016 13:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E14242880D for ; Wed, 5 Oct 2016 13:03:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5D4A2893D; Wed, 5 Oct 2016 13:03:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C45A2880D for ; Wed, 5 Oct 2016 13:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751674AbcJENDa (ORCPT ); Wed, 5 Oct 2016 09:03:30 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35643 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750964AbcJEND3 (ORCPT ); Wed, 5 Oct 2016 09:03:29 -0400 Received: by mail-pf0-f193.google.com with SMTP id t25so6297894pfg.2 for ; Wed, 05 Oct 2016 06:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=PAuIqjC4WMjnj2x1tTRmDa7zfXJjAYHiZisaIGHXRPs=; b=y2aB/zwl0HIz7Cd12+u/tSXLGl1F1WbwQL9z7X57QCt23oxH7hQvOA3GyUpKnBZBW1 i/UI4Xp04oxVu0mHPyjGv+64bWhmiW7cXnDHzEvBsuU5AbKLp6/LLqaaR2f5kVfWAJoh x+8W7dbhuStMDeu3MwCnKHawVq0p/lOX5KcYivRb6UdvSQcbiGe/uRAXW3oNlrvQVYtZ zPB/7y6bmlUnurovGPNzKXJlq7kf88K36moT6m3x1x24+IS2Znm+Iv/2dYdmE36Au0Lv sI/B+G8C/XYzoelD+cuHMBpq69EISVdRKgrJk9Hp+C0VSCtH4kygOs0HDxfwUt64yLWz jRvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PAuIqjC4WMjnj2x1tTRmDa7zfXJjAYHiZisaIGHXRPs=; b=lLZ2HAeyp+0wyMUYjQB09Iec2lGKVzVgikevMQvrzyRWV4TE/4hZh9g6SzB4M7wYP2 DFnLBHs195HFnBVltb3yCloatT34rjsHye3WxMDgXiDcIgUvnjgcCINCNl4KpMz7uAny D6jbFGKHDUfyXgzH4Ny5ASqKOh9my7XRnAVVVHhsFBih1VB7QeTh1HWB8ArdYg9S95EI h41GiKq3FSOLHp6T5bGifojsAv22bP1zePyxPxpgVQvV3Ebj4nWQp2Mu//TqREleMHNB LuaB7TeA5Hit+ymAFRP6fRtz5AWwcIOg5jxAyZ05DQl9vkiiz6Y1LuO5s5ycwmUKlZxs XftA== X-Gm-Message-State: AA6/9RlGfMbGN8U2NabF6VKNU+vI3iS6jvYSWh0a05xxo5NmfwTj8gVxWJ5yGHmyK6QUfA== X-Received: by 10.98.43.17 with SMTP id r17mr7891002pfr.115.1475672608709; Wed, 05 Oct 2016 06:03:28 -0700 (PDT) Received: from localhost.localdomain ([106.51.242.29]) by smtp.gmail.com with ESMTPSA id ra13sm14202241pac.29.2016.10.05.06.03.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Oct 2016 06:03:28 -0700 (PDT) From: Prasanth K S R To: linux-btrfs@vger.kernel.org Cc: Prasanth K S R , dsterba@suse.com Subject: [PATCH] Btrfs-progs: subvol_uuid_search: Return error code on memory allocation failure Date: Wed, 5 Oct 2016 18:33:12 +0530 Message-Id: <1475672592-3963-1-git-send-email-kosigiprasanth@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Prasanth K S R This commit fixes coverity defect CID 1328695. Signed-off-by: Prasanth K S R --- send-utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/send-utils.c b/send-utils.c index a85fa08..6f80b6f 100644 --- a/send-utils.c +++ b/send-utils.c @@ -486,6 +486,11 @@ struct subvol_info *subvol_uuid_search(struct subvol_uuid_search *s, info->path = strdup(path); } else { info->path = malloc(PATH_MAX); + if (!info->path) { + fprintf(stderr, "Memory allocation failed\n"); + ret = -ENOMEM; + goto out; + } ret = btrfs_subvolid_resolve(s->mnt_fd, info->path, PATH_MAX, root_id); }