From nobody Mon Feb 9 07:22:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AAE8C0015E for ; Tue, 25 Jul 2023 22:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231657AbjGYWBE (ORCPT ); Tue, 25 Jul 2023 18:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231157AbjGYWBB (ORCPT ); Tue, 25 Jul 2023 18:01:01 -0400 Received: from mail-oo1-xc32.google.com (mail-oo1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FA97BC; Tue, 25 Jul 2023 15:01:00 -0700 (PDT) Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-565db4666d7so3761602eaf.0; Tue, 25 Jul 2023 15:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690322459; x=1690927259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lUZnk3BJHa8i4G+I5FHI1a5ZCFbsEeNLgSVmJzgYbxk=; b=XVK1FzTn/TccXCjpTjt4Pf6a69wnwkxxmHdsFbn42YM2M4vBpG1M4prm2pxLW7iMwb uZQbixtobzfmh9gLPJ+pgLfuyfWnGX2TiVWggmdqsfsxE/zrHdbRUbvWB3USqA3bEtMI PjPLe32eJNSaKLmxx4YIeiF2PLzzAHnp7WVo/wPq34UgfQvRjJ34u9jeGQgz1s2qmIvF g9c55G8A1MynG6olwvA77cUcjqSdyAgtw/DVD81YZGnjmZgw9wySkd5jHjom/NPTD9CB w2KU9o+XcURSi03JKAtuk1kts/CReVvTu6TU2tIFkYWvpDhaKbMAKw5EdrM9yFDW4cSL fjhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690322459; x=1690927259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lUZnk3BJHa8i4G+I5FHI1a5ZCFbsEeNLgSVmJzgYbxk=; b=UqzTTOJ+IWgBLKsd6Bhm25yfFxoI3b9eAw+7HgWnmaYY/1SMI95fhAwoWSRZutG1Wr v9bvUGsz8DIjAv2IGo3b84NKHt+nGBwXw6C0gXa2ZSBETUmFGT7/6dkls1ioQq2xLt9L cnvKcmcQ5MNAXEPZ4pm8PmMKJdvGSrOoNuHYngOKaaMNUns8wviGb9JTCuOu9KGgBbqP jAyJ06Z3GlwL69TMe+RikjyJKzfZHZhaVZYCqiVVBK2TICltF80TH1e8uDLyuwxpPJRX Q3CsJFE/rVm7t6krd8NNXE6PnGfu3suqNw7znyoTk+V2Zcz6fdtltghWFbJrb+tEZZab Xihg== X-Gm-Message-State: ABy/qLaBvn0FsSAA/W6zK3BtZhMT4xYge6df/VozL5nhuayi7ZuAzqIP g52g3PYGAKe/ZlCC3tNdS3M= X-Google-Smtp-Source: APBJJlFHbPlurwcX03fBvkaEqCG30OPkMJnrFKVl1kvNbFWF5Iu6L7x7GY8nuxej+cWPcjRmow0TZQ== X-Received: by 2002:a4a:3c17:0:b0:565:bbc0:2e36 with SMTP id d23-20020a4a3c17000000b00565bbc02e36mr98675ooa.3.1690322459704; Tue, 25 Jul 2023 15:00:59 -0700 (PDT) Received: from grumpy-VECTOR.hsd1.tx.comcast.net ([2601:2c3:480:7390:871d:ebb3:c6e2:8ac3]) by smtp.gmail.com with ESMTPSA id v40-20020a4a8c6b000000b0056688eea98csm5870026ooj.27.2023.07.25.15.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 15:00:59 -0700 (PDT) From: Jorge Lopez X-Google-Original-From: Jorge Lopez To: hdegoede@redhat.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, thomas@t-8ch.de, ilpo.jarvinen@linux.intel.com Subject: [PATCH 1/5] hp-bioscfg: Fix memory leaks in string_elements_from_package() Date: Tue, 25 Jul 2023 17:00:52 -0500 Message-Id: <20230725220056.25560-2-jorge.lopez2@hp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725220056.25560-1-jorge.lopez2@hp.com> References: <20230725220056.25560-1-jorge.lopez2@hp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Address memory leaks in hp_populate_string_elements_from_package() and uninitialized variable errors. Signed-off-by: Jorge Lopez --- Based on the latest platform-drivers-x86.git/for-next --- drivers/platform/x86/hp/hp-bioscfg/string-attributes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c b/drive= rs/platform/x86/hp/hp-bioscfg/string-attributes.c index 1b62e372fb9e..e0ecdfca4def 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c @@ -133,7 +133,7 @@ static int hp_populate_string_elements_from_package(uni= on acpi_object *string_ob char *str_value =3D NULL; int value_len; int ret =3D 0; - u32 int_value; + u32 int_value =3D 0; int elem; int reqs; int eloc; @@ -171,6 +171,7 @@ static int hp_populate_string_elements_from_package(uni= on acpi_object *string_ob if (expected_string_types[eloc] !=3D string_obj[elem].type) { pr_err("Error expected type %d for elem %d, but got type %d instead\n", expected_string_types[eloc], elem, string_obj[elem].type); + kfree(str_value); return -EIO; } =20 @@ -232,6 +233,7 @@ static int hp_populate_string_elements_from_package(uni= on acpi_object *string_ob str_value, sizeof(string_data->common.prerequisites[reqs])); kfree(str_value); + str_value =3D NULL; } break; =20 @@ -250,6 +252,7 @@ static int hp_populate_string_elements_from_package(uni= on acpi_object *string_ob } =20 kfree(str_value); + str_value =3D NULL; } =20 exit_string_package: --=20 2.34.1