From patchwork Wed Apr 12 20:47:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 97343 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp437556qgf; Wed, 12 Apr 2017 13:47:14 -0700 (PDT) X-Received: by 10.55.71.137 with SMTP id u131mr31143266qka.317.1492030034043; Wed, 12 Apr 2017 13:47:14 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w34si8852639qta.307.2017.04.12.13.47.13; Wed, 12 Apr 2017 13:47:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D345E64823; Wed, 12 Apr 2017 20:47:12 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id BB81763667; Wed, 12 Apr 2017 20:47:10 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 360196368B; Wed, 12 Apr 2017 20:47:10 +0000 (UTC) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by lists.linaro.org (Postfix) with ESMTPS id F3EB963521 for ; Wed, 12 Apr 2017 20:47:07 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id o81so96855245wmb.1 for ; Wed, 12 Apr 2017 13:47:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PtbA4v5Q9ZdU9FSDvu2nL4dRZIvGcbRq6YLEYTncgzE=; b=FMe+Narep1FdF4IXw4RhRaXrYs+N2U5EmwCqq2xfve4h6OoECBPW89BKGPvBsnhbvJ L17YMNMroLDedgMqj4WVZ0o4pJpvttFE6klwDEk0hrgigOuzIFlaNFaj9rKiMTCBD1vo pB/Anp06MxpOmqRPTocK4MJlTBX/5NqIzlk+Q/OntbtA9fR07ZOywE9iAVE4prIkm5wJ 8mnH1D6BWRymSZ8gE15kOis7Q4f9SjTwjOirniqh78K1YiLOZX/qg/PTMfunRTPGl4j6 IpzzS0GJ1PboE+vLteU/p8sdCJasU7QbyFfvCJlvbo4CMFz3dALCg77CRYQxDRIwaLh8 OGkg== X-Gm-Message-State: AN3rC/7Di7JT7MDh5nKA5FIM2S2EqDo7Ga71g1z3408txbO1LaKXq7lZ /GKGlwHJVWXLI30ISUw= X-Received: by 10.28.184.73 with SMTP id i70mr123891wmf.104.1492030027069; Wed, 12 Apr 2017 13:47:07 -0700 (PDT) Received: from mohikan.hemma.eciton.net ([2a01:348:6:8735:e23f:49ff:fe6d:9d26]) by smtp.gmail.com with ESMTPSA id 198sm7918869wmn.30.2017.04.12.13.47.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Apr 2017 13:47:06 -0700 (PDT) From: Leif Lindholm To: linaro-uefi@lists.linaro.org Date: Wed, 12 Apr 2017 21:47:05 +0100 Message-Id: <20170412204705.28961-1-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 Cc: Alan Ott Subject: [Linaro-uefi] [PATCH] Drivers: MarvellYukonDxe driver binding fixes X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Fix a case where MarvellYukonDriverStart attempted to free a buffer before it was allocated. Fix another case where the function returned without freeing the same buffer. Also correct the error message for that case, which was copied verbatim from the preceding if-statement. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm Tested-by: Alan Ott Tested-by: Daniil Egranov Signed-off-by: Leif Lindholm Reviewed-by: Ard Biesheuvel --- Drivers/Net/MarvellYukonDxe/DriverBinding.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Drivers/Net/MarvellYukonDxe/DriverBinding.c b/Drivers/Net/MarvellYukonDxe/DriverBinding.c index 947d738b10..cbe8ad34e4 100644 --- a/Drivers/Net/MarvellYukonDxe/DriverBinding.c +++ b/Drivers/Net/MarvellYukonDxe/DriverBinding.c @@ -127,7 +127,6 @@ MarvellYukonDriverStart ( if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Marvell Yukon: OpenProtocol: EFI_PCI_IO_PROTOCOL ERROR Status = %r\n", Status)); - gBS->FreePool (YukonDriver); return Status; } @@ -156,7 +155,8 @@ MarvellYukonDriverStart ( } if (ScData->msk_if[Port] == NULL) { - DEBUG ((DEBUG_ERROR, "Marvell Yukon: AllocatePool() failed with Status = %r\n", EFI_BAD_BUFFER_SIZE)); + DEBUG ((DEBUG_ERROR, "Marvell Yukon: invalid buffer size\n")); + gBS->FreePool (YukonDriver); return EFI_BAD_BUFFER_SIZE; }