From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.38 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796358089; b=1uZjYVk3VfT9IWrAaeBoSBGSTfSIV4qWCuWzFdlfbZ+LkYvy8Snt5T2n6wroAY6xnfkV 3BAmpy1hwDpj1L6/t6I5UdXDx71mHyZMzrPImJTIaZUSQgZ3WFCGGPfeO95raCBaXBjvh uMnNTAniDgFQ7ki8F3EDk4GuZ3aqW/dr+4OF2J8Oaazvs+VSeH/9uhEqERypcUYTBlFfl dcI3n4pJJL4OJGoYWqbAxzc9wzpIkiipV5wHaW3YN54b9u8H6fcP8PIjYpL7Cn733ixYh xijWy3ko+I8/1GHmLpCtRWTxfyBaVjqp15ExSudIUtyUlQ31DGEueRYn/wG2aWmnEcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796358089; h=DMARC-Filter:DKIM-Signature:X-Original-From:Received:To:From: Content-Transfer-Encoding:In-Reply-To:X-Mailer:Cc:Date:Mime-Version: References:Subject:Content-Type:Message-Id:X-Lms-Return-Path; bh=NdwjPWpn4BXG8MnCjtKlzvuSUqne8dg0gYpIbZWu0uc=; b=D8gluEsQC4eHNlxZzDL8avtjRthAyKCVNC6mXXCc3jcpyJdPzIiZ6y16il7zx3SHvEkF JkHDMtBadKL8ojdq0Vq5gw928FkVM95hb9Gsn0ITTc0uk2oGswcj3hT5n0QdYRgxjy1UT vevaUqCaJuXjeMwa68lMrXsybzyKx/Fo7ErsRVjSr+E3XHRhNL7elywzI4ZHTSkYujy4c WPl6Fmw9cKT0D7rfSZDCFveSEdqL4y/BbIDkb9T4el8zyWnYVSs4IBhGsomFTYDX3lYcn GJBmrmRFFThjRR6CSs5E5B6eY1nIAPcOygutHjrdKM/pdkA2AKr7XxW1UDhwCz9LpeQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=deepcomputing.io; spf=pass smtp.mailfrom=deepcomputing.io; dkim=pass header.d=deepcomputing-io.20200927.dkim.feishu.cn header.i=@deepcomputing-io.20200927.dkim.feishu.cn header.a=rsa-sha256 header.s=s1 header.b=TpzE3pV1; arc=none smtp.remote-ip=209.127.231.38 Received: from va-2-38.ptr.blmpb.com (va-2-38.ptr.blmpb.com [209.127.231.38]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF0E3606A33C for ; Fri, 4 Dec 2026 04:21:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DF0E3606A33C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=deepcomputing.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=deepcomputing.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=deepcomputing-io.20200927.dkim.feishu.cn header.i=@deepcomputing-io.20200927.dkim.feishu.cn header.a=rsa-sha256 header.s=s1 header.b=TpzE3pV1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=deepcomputing-io.20200927.dkim.feishu.cn; t=1796358084; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=NdwjPWpn4BXG8MnCjtKlzvuSUqne8dg0gYpIbZWu0uc=; b=TpzE3pV1myWV1YZfCz8uWFj9TehHM9TS0WWe4gToxgasFSVbtaihPIKM1u6XH3YXqQPXrg 6TFo6gLvDkxefHH68oaE173uL7Nri3st+Q7PH4Jm1y2IZ+oqgaxQUZGgslu3Gdb74THxL2 zcTFiOV2xwbtNY61VzFaAaGHVo0iunzft4AF+iv3cENoYZtUykY0IbCTFNfwHoff/HK3Ov vW80Vn3QLobsCZ6NC7am1kOjhtAjApG7PimjQgksgwZJ1yVTFTngqVn99Vy5pUkT+nW/9F dRw2rCHMAxkm/EKa+HD+3C+GfU8G2wIvozgUVytGI18OtU827rtphKKrTeueOQ== X-Original-From: Wang Yang Received: from ubuntu.. ([183.23.101.24]) by smtp.feishu.cn with ESMTPS; Fri, 04 Dec 2026 12:21:21 +0800 To: From: "Wang Yang" Content-Transfer-Encoding: 7bit In-Reply-To: <20261204042112.2985112-1-yang.wang@deepcomputing.io> X-Mailer: git-send-email 2.43.0 Cc: "Benson Leung" , "Tzung-Bi Shih" , "Guenter Roeck" , Date: Fri, 4 Dec 2026 12:20:59 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261204042112.2985112-1-yang.wang@deepcomputing.io> Subject: [PATCH v2 01/13] platform/chrome: Correct LPC EC readmem bounds Content-Type: text/plain; charset=UTF-8 Message-Id: <20261204042112.2985112-2-yang.wang@deepcomputing.io> X-Lms-Return-Path: Reject offsets outside the EC memory map before calculating the remaining space. Allow fixed-length reads ending exactly at the end of the map and reject oversized reads without underflow. Prepared with OpenAI Codex assistance. Signed-off-by: Wang Yang --- drivers/platform/chrome/cros_ec_lpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index 1e683e90a9df..4ddd3ca0effa 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -417,7 +417,7 @@ static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset, int cnt = 0; int ret; - if (offset >= EC_MEMMAP_SIZE - bytes) + if (offset >= EC_MEMMAP_SIZE || bytes > EC_MEMMAP_SIZE - offset) return -EINVAL; /* fixed length */ -- 2.43.0