Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3087347rwb; Mon, 15 Aug 2022 17:49:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR4DzcqP9Gyz7lWArhe6qkJpRoKySYmIov6O0+6FWwsLRkwSJaNf875bDvDNp2my15ybIH7w X-Received: by 2002:a05:6402:3323:b0:43d:65fc:8d29 with SMTP id e35-20020a056402332300b0043d65fc8d29mr17361148eda.251.1660610957390; Mon, 15 Aug 2022 17:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610957; cv=none; d=google.com; s=arc-20160816; b=xgYQoqiN8rYx01GtZZiM/bmuiEezlM256EWRmclfDjhC/SzIkVcvWjGuRDwrdGk06I SKlubiFsEFN/wy+7CjIqdMTyidIx6Pd6Br/qZ93SAnG6FOfbxJgsX68mBT0ZHIFD03X8 1ulQP+ufGvU8ZGFbrMfQogAAAwpxOlv7KqZ5nBc4OC7P4wHV9Ws5dx5fzuQhNiKtZo95 GEznN2v2Lur21qgtsLRq+eoloFwYiWzMuJ5VSrOaL3EPSZLdcdrIgoCuE+hsq/FBb7SO g2MkcwRe5rhdEPTxRJDGfPah+4ToP1L7wxuGUQeX657lP9BTNs4ZxdKYKZ2DHR00kf9h HN/Q== 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=u2HpsSEIPBYmD4FGtYck1xsfT2ppjmG405+bbYBzBA7aCbBHRWhlZi2hngvH7sFTkn woVvjlOOiM8Z0ytEzWz6Yp83pd1He/yDmO+X+OE74mMePwKYJm16qj2gXhmkjxEJp074 OkfXIA6lMBOpDyo44YDRJ71J8rFQaOuTz6/Mv/4WMz4DqQCL2o+Ui05R5Qt8cJn/LSJe ke5cC7Px3ErvUOa1HGkI5NTIqgQcvHMA+bxRK8QuxJEgkuPSYY/gomb9tCO54yYCYvZQ g/D/25MzO6CcJZHe6/vZmApWSO736efW5oDxQYtbIAnK95rbCxmdjlYVLfdnzsJAgcI+ oidg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="a/OhsFFx"; 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 e1-20020a056402330100b0043d5404f4fasi8196689eda.104.2022.08.15.17.48.52; Mon, 15 Aug 2022 17:49:17 -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="a/OhsFFx"; 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 S1344089AbiHOWXs (ORCPT + 99 others); Mon, 15 Aug 2022 18:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350780AbiHOWSb (ORCPT ); Mon, 15 Aug 2022 18:18:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDA89419AA; Mon, 15 Aug 2022 12:41:33 -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 ams.source.kernel.org (Postfix) with ESMTPS id A03AEB80EA9; Mon, 15 Aug 2022 19:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1698C433C1; Mon, 15 Aug 2022 19:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592491; bh=LDycKYnW6ye4o2A+N5sKquPsWFCQPRnl7ImjLXfcl90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/OhsFFxDuTB2vSbi4SpcnQOaO4Qlrh55oO7CuAgbo+9d87S/97zJiZLnx1p/w00b Ixyfges4Mhnc8biuoBOJZWvjV4ICou7GxmHAQh/mWKRdzZjsalXzY8lyKwHEtFTmTb JWl4wvloPxzgcA0EPAzp4zh8RZPpXB9xA7Wrt1A8= 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.18 0798/1095] tools/power/x86/intel-speed-select: Fix off by one check Date: Mon, 15 Aug 2022 20:03:17 +0200 Message-Id: <20220815180502.270345880@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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