From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35DC538F255 for ; Thu, 9 Jul 2026 16:59:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783616355; cv=none; b=TCl1ZjQbn/sJ4v0h7A3laDjW0W+3sr+nC9zLmtGw6VZOclLt/mRlabKZz3iobvVtnmxgEj3618GTluw35ujpKR2ukDn/IWH54MldyUD/NPGbL1UQDa+wkuMkpJLECa1YB7rgQyufqwkM4M0yqfT/lP1mobTawK04piyM2JWyM6g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783616355; c=relaxed/simple; bh=uJoYCDCn9PmHieohB5D8uKh80F/3g84Pf60VaEuspDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lQtvdTXczNxG3Me0bW4mp3gHkJMmrH1JD4OZzYyPex6+NrLo43PkVwJNNkDHmZUsZjklky0hg+TVOzo8VJ/umyH9jNYTPdeOydMxyGrHJQWcZRvroWTcCm8IneDOxXq7mFSk++dZtBXFMTP0OclXUwGNLFjBt1Cw4XuOjD+aQmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M1vsZ4o9; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M1vsZ4o9" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-c15d111ca99so11637366b.0 for ; Thu, 09 Jul 2026 09:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783616353; x=1784221153; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=BdQgCcOZ8AsbD39pJ/8+6FU/oteVawK7PRRyjumlzGo=; b=M1vsZ4o9xHisNGI4Ucm+gDuW05HosHIl9eHvr5jq5Q6EqyzXN2JI5JaWGbHMRe+f5+ Tl7sdUV38BoFQM5HUZMTDmrGr1XQS7vsvsjqHobfcd9my6nPPYTubHMYmAaM9wmvuB0p dnJTBa+x4gpEszalMZfUs+rWw0m0oIT3iRco3mCvDuKXrU5vWxq36Vb0pjiHFyaR57UJ VSjVcMnRUtwhg5ncAkMp5G2pVzXLJpt4zvMxpo1ZxWsn0UtpLCnmSLvBZOri6AyufO48 9CgnZGGVYbrNDK/8xOFB1+0plJtYo/99khKzBo6JFXVKxeb4+R1+wHabwgjPhdbTAyna xl7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783616353; x=1784221153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=BdQgCcOZ8AsbD39pJ/8+6FU/oteVawK7PRRyjumlzGo=; b=TUkYQpxO4s/F/tzaBMfhTknAAWxGLomSO9lFi/nj4WurBxS7g8FFvRG7iOHLyxydou x7lJHfkW93hYHRd3naERMgn777zlPT6IKisxMAmFPU/1UBBUAdZMcP/waeqHdGzf+C35 FK9PuwqanlX14s2fB/wfmkdTZU8cRTOQpnMPs8ttXGK0XbOAQABvlI9mCaoBzdOEZK0i OtAphxKPlnEXs9y0ZrnET96qCqz//tGz0b0nyME1nDXRw81wrfZGaG4e0E+pmbllafyL avT6yHAxeF3hxyiJMakzt3xTQNGqU/RcVSnUFYTtMi1zI6zJNxdOcGaddlglTSTYf9xB V6ow== X-Forwarded-Encrypted: i=1; AHgh+RrnCfzkRHtScL4kzPNNnawhMKjndT6Z1PVOgyMXPvK282Sot2FZtH3AtQH5Pj3/QD4BIGZ7SLAoXo1ciUk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7IoLBqULcyntKA3lFozAbTtOIwbhL8Ju/Il5m+phBgZ7jS+xI 0cCyZo0eFFJYVw35OctXP5MNJamFkr1jHug2dHSYgtoqDwkUwiqXrW/W X-Gm-Gg: AfdE7cm536+1t47l6a6uvM/NeO2taP11SPf4cQDPTnLmi4sdHMp7e9xUdmiud7uSE8H uvNrh03ISQQLjJJpsrtcnoIZvyjTYyQ4Jojab0sYNUVnum3fq6uooIRmEeb/rSrBMAhyKS8KZWI 7Qa+ls1dtu9WvHspTLsnRWH5d4oFJEs32opjw+ZV/RuFW8KDsj4+RGnJRf/bLwJmIEwm0KIlQVX 89/xH6bRitYgGJUAiQOQEtRUCfpEv0EeJkI4FgRkJZevC1UO7BYYbPVgcA7ciwfew54O6Mrg6MJ 2/Mz0m4lMLfI7olw7qLKMMcTAeBzbOSB+EMUCuozCKxvWcVLbV1rI6pZGQllYrT9paegPJ3Rh9C 8DGFIuNp7JrJXa5eU+yHuIn4rIz4ex2uLvVctTmMFm0l6Fnab8IJ28DpOhiGleBp7ncSjb7LJmL CjN2nBt32utoZJOP8U9bwy5KzAyoGXLulbGrWfUA7T2etUSXlDiGjwD6sc8a9JUdQ= X-Received: by 2002:a17:907:3d12:b0:c12:979c:5a5e with SMTP id a640c23a62f3a-c15cda428admr403802066b.0.1783616352383; Thu, 09 Jul 2026 09:59:12 -0700 (PDT) Received: from node ([202.47.63.86]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c15c79f2a3fsm329902666b.49.2026.07.09.09.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 09:59:12 -0700 (PDT) From: Muhammad Bilal To: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Jorge Lopez , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Mario Limonciello , Armin Wolf , Muhammad Bilal Subject: [PATCH v5 2/4] platform/x86: hp-bioscfg: bound ordered-list parsing by the package count Date: Thu, 9 Jul 2026 21:58:57 +0500 Message-ID: <20260709165900.30615-3-meatuni001@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260709165900.30615-1-meatuni001@gmail.com> References: <20260709165900.30615-1-meatuni001@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit hp_populate_ordered_list_elements_from_package() differs from the other per-type parsers: its main loop is bounded only by the fixed per-type count and never checks elem against the number of elements actually present in the package, for (elem = 1, eloc = 1; eloc < ORD_ELEM_CNT; elem++, eloc++) whereas the string, integer, enumeration and password parsers bound their main loop with "elem < count" as well. This is safe today because hp_init_bios_package_attribute() rejects any package with fewer than ORD_ELEM_CNT elements before the parser runs. An upcoming change, however, relaxes that check to accept shorter packages. Bound the loop by the validated element count as well, so it stops at whichever comes first, the per-type count or the real package size, for (elem = 1, eloc = 1; eloc < ORD_ELEM_CNT && elem < order_obj_count; elem++, eloc++) order_obj_count is the validated element count, now correctly forwarded from the caller. No functional change for packages that enumerate correctly today. Cc: stable@vger.kernel.org Signed-off-by: Muhammad Bilal --- drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c index cc5bebe73a93b..863e486474ad0 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c @@ -145,7 +145,7 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord if (!order_obj) return -EINVAL; - for (elem = 1, eloc = 1; eloc < ORD_ELEM_CNT; elem++, eloc++) { + for (elem = 1, eloc = 1; eloc < ORD_ELEM_CNT && elem < order_obj_count; elem++, eloc++) { switch (order_obj[elem].type) { case ACPI_TYPE_STRING: -- 2.55.0