Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3118113rwb; Mon, 15 Aug 2022 18:33:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR55/T5vIG/gTZYZAiW/dzNfX2NTlfEcVilyS8TyMIKIl07FNq3loy3SMlab1O+H2i5EHBoX X-Received: by 2002:a63:e016:0:b0:427:e7f2:32b3 with SMTP id e22-20020a63e016000000b00427e7f232b3mr8994319pgh.194.1660613616142; Mon, 15 Aug 2022 18:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613616; cv=none; d=google.com; s=arc-20160816; b=Jsn2tzp7CmCyHIDb1PLiSfh3axhyJi5R+U+nV13iYC+ToY8nTg9yFw3Bm1TnkZoGFG A1JesA2hM0c5N81HsmCfpdcAQOp5lmBufFohpg+fpxonPE3lJ+P5usWw6sXybIxh08xE w2bPUv3WrK3CaRA8nWxYJg9BV2V4EEfJyDepNX9BCl5/BQNsXnvg6Nk4C1merCIOUMOv CpaZlRcCA8wVROzGw7tZkzaXoRnBeM6UGpvE7E0aDlysblWADFCf4zByaLh7rwYrNY6V Y9f7YsHPJUgOSJoHeDOvHNTEbbAUD4WRWy/ZVxxnZ2H0qOPl+SYCE0ciiOUcOfd3Wyky dP/A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JLeUjTGK5nvfu3IQ4GML5nR5kJQ0UO5i0FUTpQzxDO4=; b=day5J5tIcPWWhDZFlcWdV76y+5juthKbqnjGrl5CLrDshBIq4aBVtCrRVY4g+5IuoE kWqnU1hyDJLSnxj5DLXeUtekLuzHuvZmGP+83DhE767N+hAUbVaPgO5LId7+SHoNFSBW MsfF51ZL4E+IWWh6mEpBLkWjVlZxMPROTsnsuBDpol2A/sqo5z1/5Wfve7Ljem14J6dw IpXZel6NbkBUJzM+UV2oRI7t8lWvRoLa+rLc60DQ9Jdfc1o3F0EJpaybTeO85kUtCwmB zNF4U9P2SvWX0TRtzlDVXfDejfng9JiM/6Yamxs5Yf44+bYyini2+mt4U5ntIWdWfGVe IY1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uidPro0t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a170902744b00b0016cd74e550fsi11320153plt.351.2022.08.15.18.33.25; Mon, 15 Aug 2022 18:33:36 -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=@linuxfoundation.org header.s=korg header.b=uidPro0t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242686AbiHPAdw (ORCPT + 99 others); Mon, 15 Aug 2022 20:33:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353182AbiHPAbO (ORCPT ); Mon, 15 Aug 2022 20:31:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC06185985; Mon, 15 Aug 2022 13:36:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE14C611FC; Mon, 15 Aug 2022 20:35:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA6A8C433C1; Mon, 15 Aug 2022 20:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595732; bh=LDycKYnW6ye4o2A+N5sKquPsWFCQPRnl7ImjLXfcl90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uidPro0txmgm5UR4FYB9jgjAZ/N8lf+uqmgQP42sgv1zOsqb9torGRRsuRPUBBToV lDw9ZWIW+Tojf+0eek4ShwAoTcTNCTvqduoeiw5/IWg34OMNFs9PYdjFXdRuJY9YBO CLWbTUxML0t/nO8mB+k79KtVeZBzGnzL9r+KBG0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Hans de Goede , Sasha Levin Subject: [PATCH 5.19 0856/1157] tools/power/x86/intel-speed-select: Fix off by one check Date: Mon, 15 Aug 2022 20:03:32 +0200 Message-Id: <20220815180513.728398277@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 From: Dan Carpenter [ Upstream commit d9f74d98bbec978edbf860f729b531281ba0d8ff ] Change > MAX_DIE_PER_PACKAGE to >= MAX_DIE_PER_PACKAGE to prevent accessing one element beyond the end of the array. Fixes: 7fd786dfbd2c ("tools/power/x86/intel-speed-select: OOB daemon mode") Signed-off-by: Dan Carpenter Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- tools/power/x86/intel-speed-select/isst-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/intel-speed-select/isst-daemon.c b/tools/power/x86/intel-speed-select/isst-daemon.c index dd372924bc82..d0400c6684ba 100644 --- a/tools/power/x86/intel-speed-select/isst-daemon.c +++ b/tools/power/x86/intel-speed-select/isst-daemon.c @@ -41,7 +41,7 @@ void process_level_change(int cpu) time_t tm; int ret; - if (pkg_id >= MAX_PACKAGE_COUNT || die_id > MAX_DIE_PER_PACKAGE) { + if (pkg_id >= MAX_PACKAGE_COUNT || die_id >= MAX_DIE_PER_PACKAGE) { debug_printf("Invalid package/die info for cpu:%d\n", cpu); return; } -- 2.35.1