From patchwork Tue Mar 20 02:46:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 887996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 404y4Z1tM9z9sW7 for ; Tue, 20 Mar 2018 13:46:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="LXOniMKM"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="NQQR4r8V"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 404y4Z00tjzF1kW for ; Tue, 20 Mar 2018 13:46:38 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="LXOniMKM"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="NQQR4r8V"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mendozajonas.com (client-ip=66.111.4.29; helo=out5-smtp.messagingengine.com; envelope-from=sam@mendozajonas.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="LXOniMKM"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="NQQR4r8V"; dkim-atps=neutral Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 404y4T5bt3zF1dG for ; Tue, 20 Mar 2018 13:46:33 +1100 (AEDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id C10FD20AB3; Mon, 19 Mar 2018 22:46:31 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 19 Mar 2018 22:46:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Fo/KJudY4Mznbam7a LG4+NpCuX+6B8qrUy90ogcgKZ0=; b=LXOniMKMCBfZWNnvnKkoZUOEPfrvgYjVs qzzQNY0H01UcRnQExdaBS7ur4tLSQ6KBwkBhBN02I7p74rJOeBNOxSH/Gt3tn4qJ s4fbCMQpYd3AvpocsVcFxu2tNsE9B0U8EExB1SOycIb7wS5hah69+GQgMj8V+FrR 7yDZYgKDxoih6MqVvl0aYakw3lhBaId4BG4K1j52KFNkoXZ5D99lJ/npNM3KmcFq b7pWT8wIhaRU151PTREROX2RpqpIXgValHmPR3ihZhpmK/le6LbCGfsSfTXKU2v4 b08ytTcC7uzsq1pkPv0u7r8leAMdUct3LVMaWacgEQ0IiXXt2G7hA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Fo/KJudY4Mznbam7a LG4+NpCuX+6B8qrUy90ogcgKZ0=; b=NQQR4r8VJZ/+Z0bCPXcvm63rwD8nSuYEP 5G5Ym7UbsiG/jADph0KC0d0j5Km2hIJVdyhR3S3glCR8QlFG7FiXLAQ98DiMRTD2 9AeDHUyLfola/v/x6jxgACz9wSaCods8zHm6DBlL89oO7UV71eSEwMVjjOoSFi95 4mSlqBQTtbnQzw8wrIMp5d+oUyffRJflyixzfLs6+tHAB/1fCaU8zNPs4rV2DxSV f2YnFzXWt78DOjcB16ZM9YwhJNzMlCbs48QT53LZrIric/TcMDvEkjRDF2JuEpBP fZf/i6hl005Fpj6rf9TgtCJgMh9iKaIo+727GBnejG9Y+Bus99okQ== X-ME-Sender: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 974B17E13B; Mon, 19 Mar 2018 22:46:30 -0400 (EDT) From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH 1/2] discover/pxe-parser: Avoid potential null dereference Date: Tue, 20 Mar 2018 13:46:21 +1100 Message-Id: <20180320024622.4435-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.16.2 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Fixes Coverity defect CID 149918 Signed-off-by: Samuel Mendoza-Jonas --- discover/pxe-parser.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/discover/pxe-parser.c b/discover/pxe-parser.c index d2ebaab..fd8b8e8 100644 --- a/discover/pxe-parser.c +++ b/discover/pxe-parser.c @@ -273,12 +273,14 @@ static void pxe_conf_parse_cb(struct load_url_result *result, void *data) if (!data) return; + if (!result) + goto out_clean; handler = talloc_parent(conf); - if (result && result->status == LOAD_OK) + if (result->status == LOAD_OK) rc = read_file(conf, result->local, &buf, &len); - if (!result || result->status != LOAD_OK || rc) { + if (result->status != LOAD_OK || rc) { /* This load failed so try the next available filename */ info = conf->parser_info; if (!info->pxe_conf_files) {