From patchwork Mon Jul 17 20:59:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 121610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1350665vqt; Mon, 17 Jul 2023 14:20:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlFSqd4qcsRdtHT6Vt8viI1fj5dn/a9ydAMUrq0GKq3sOiqHA0gW27YTUS4nNOFwK1pCgX3D X-Received: by 2002:a05:6a20:c89b:b0:133:c9f0:ce66 with SMTP id hb27-20020a056a20c89b00b00133c9f0ce66mr9342977pzb.18.1689628838189; Mon, 17 Jul 2023 14:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689628838; cv=none; d=google.com; s=arc-20160816; b=FR8TPQAwcy68hO/648ofnDIOh3Nkv+f79XtWCuxQkAZ/pXHtDBdm/G5E2/X/+5FYYM oNRboLHwlQwx4mdPnkaZRlXpU9fgSDbQNJluoifXrr02DEEcRAfe8SzERP+GIqp62Zjx u06bw1O6tmD8R7AM7loWKGZGc/bUjiaPIGby7JL7qwuNZXAdddxAP4qAAGYJZ+n9lRwB BdRcYky9rCn81bir9dB5IBxskRPZG+LbPxIlKnnSFBEPzJfI2Zpof/OxHn3qTvVMftUq Nn4HPUb/sdutfN4AWHu1rmY4K8x4JV2pKDeYUSeKwgpxm9VSL3BHlezXPIYy/3zcvT+s JjNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bBwLuFazUuxYCGfEXRFxeHu86Q9tYW1XepWJEFG929I=; fh=3kO181L50Qcr0y55afcdcyD39TL/YS79tVW5ZtpSGcY=; b=LvE5FtrFCnM2bqiCbXFs+TYN8sbB02GQnvpQUu32RihyQT1e3lqnr/AorbCeg0fF0x a2A/37dsIaommWCrmdbyERoLpNPVJk9GNVicFiH/EAhu23deIAw+UNij2HyMqwKGjhwf K44ulbBf0EQIavctDQpYQDvFagLOIxQQ/tCT3tUgVENBAqZN0ZmaKvqMT4xlVVCdoBKe 2RiulFui7dmwZLbbbQR2wrOvH7cbFOTts+jjafzMYHdzCaHIrbZFH1NtTjFt8+38BAXV yKg9lYyKIZeFaVfx9Sm2hlTrfpRqHCAlvcpf53Ig7rYz7PahAOHv9nDJG5FsULGXpi8X CIQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=bBnCqgby; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i195-20020a636dcc000000b0055bc27f07a9si418755pgc.93.2023.07.17.14.20.25; Mon, 17 Jul 2023 14:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=bBnCqgby; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbjGQU7N (ORCPT + 99 others); Mon, 17 Jul 2023 16:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjGQU7L (ORCPT ); Mon, 17 Jul 2023 16:59:11 -0400 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C08A4 for ; Mon, 17 Jul 2023 13:59:10 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id LVJCqUVoYFtSYLVJDqOY7F; Mon, 17 Jul 2023 22:59:09 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1689627549; bh=bBwLuFazUuxYCGfEXRFxeHu86Q9tYW1XepWJEFG929I=; h=From:To:Cc:Subject:Date; b=bBnCqgbyiMVdDcTfAiV13KWJ+nMAcHQ4A1fYFzfHrR4flM9hjIb/z63k1uiviOhM6 umJvYXgXrfHZkSoCPKg5b96aLoLFeJnhF2m0q2r9tg5sxWpQpkArXzd+nbUR79ALxV ca1rahGgOJ3CdhL/0n4DLqs1o0UKGdWtc2luHACVxJWbQ3EBjRf0P7yIQXkTkv299I ZY1ATpTB8B8WT86vU8Ne42vutpWSbRU+MhQKEXiCEGtX8sDyiYIouanqZ8yyT2SZBk v3P3R36xMYJ8o4bLAu3iF9h9Vw6cJC/h84RxNyo842mIkyZQeN64qnQopMQni/22m7 /DmDBYCK0Fs4A== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 17 Jul 2023 22:59:09 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Jorge Lopez , Hans de Goede , Mark Gross , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , platform-driver-x86@vger.kernel.org Subject: [PATCH] platform/x86: hp-bioscfg: Fix another memory leaks in hp_populate_enumeration_elements_from_package() Date: Mon, 17 Jul 2023 22:59:05 +0200 Message-Id: <2a60147e2d555a77d348d1bdfec160bc936e1dc6.1689627531.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771704248569691074 X-GMAIL-MSGID: 1771704248569691074 If the check that both expected and read object type match fails, some resource may still need to be released. Add the missing kfree(). Fixes: 6b2770bfd6f9 ("platform/x86: hp-bioscfg: enum-attributes") Signed-off-by: Christophe JAILLET --- /!\ Speculative /!\ This patch is based on analysis of the surrounding code and should be reviewed with care ! /!\ Speculative /!\ --- drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c index dd173020c747..8e615ccfc9b5 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c @@ -164,6 +164,7 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum if (expected_enum_types[eloc] != enum_obj[elem].type) { pr_err("Error expected type %d for elem %d, but got type %d instead\n", expected_enum_types[eloc], elem, enum_obj[elem].type); + kfree(str_value); return -EIO; }