Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4024619rwl; Sun, 2 Apr 2023 21:12:54 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/SPOLIbLWlRD2EdfG8Bd3WraYyYdetjPkBHDJVtIcE8xS/bPdhg5bCBif5HhypBCwNbcZ X-Received: by 2002:a17:906:4f0b:b0:931:59f:d42 with SMTP id t11-20020a1709064f0b00b00931059f0d42mr36509543eju.29.1680495174664; Sun, 02 Apr 2023 21:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680495174; cv=none; d=google.com; s=arc-20160816; b=W1MiSVT1f7+10GPNGLcZdPHfYiroABJxU8E9qhk3adrgmw11/z39oRIihSTTB81ohX 1NDsdXeVszvk7YSDUxbEtk+7WNo/slLZvDFr/3NtBXzH3quqATXjpxwHDuyw6FqmewXS KrJEEXvJQTtK0nziH20Q372j/saKEWBlqzOxMJpjs4tcyJ/zGQWKOD9apobhpt9XW2UF tiUHSnWSUC4tY/msDea+NF2lT05rMb35gb9o130dW/Jg96HCgJos4ZLypFgo64Edfi3X X2A22wkVvfFef+5bJDe/DMl905oWB7KOf7NWYL1YpbHElU4JLTCvbj12pm7wykOUesxH 1Tcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=27R2g+sDxLnJbDwWfWYA6YvPE6yIAlipgv7jbis7U+s=; b=SgciLr0fQkE77VWcZHhj+bSsiiCYF9aPnDTRBjCiy8NNuTq8fmq9nhmcEQ7AGuUri3 moz8PH8QuF/yUHQGbVdQ/zsawvJ0/d/LBpqOrWT/up5lk7RsReVK7vLkz5veiySqrJbe GxebGdNNg62BJDZfI31UqpbnM3CmxrTzu4cgO0BdLaIe7jADCz0M5fnqmpO9Ze3s8fY1 FsgRtCblxT2Y4Lt55+dAS2WWMZQA7Y+frxTCJm+Gu6PcX+q4SE4D0fX+FHSS07aNyqxb vaJgwKoKUOB/hynDP6aXzBx+ozJZueOQ4nLLtkYGLv2ULx6CjdT+nJ172+8FXH65tnFJ 5Ccw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dNAh6oWQ; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a1709064a5300b00946bd53bbc8si2042022ejv.403.2023.04.02.21.12.30; Sun, 02 Apr 2023 21:12:54 -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=@linaro.org header.s=google header.b=dNAh6oWQ; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231329AbjDCELf (ORCPT + 99 others); Mon, 3 Apr 2023 00:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbjDCELd (ORCPT ); Mon, 3 Apr 2023 00:11:33 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B52A2975A for ; Sun, 2 Apr 2023 21:11:31 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id u10so26760502plz.7 for ; Sun, 02 Apr 2023 21:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680495091; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=27R2g+sDxLnJbDwWfWYA6YvPE6yIAlipgv7jbis7U+s=; b=dNAh6oWQL1OjTONlMSwNjlJYn5Yxg6cmRBJz7nMigaC37SGOPa4dri4N42TbSBj5e8 WgGlczwduegU8rOxnWef/451vnzJKtJ/Tk5p8A/zkNHvDrXaxeqzmO25QDKQkNlPJkOo XHhJPHQxiosq4A1PgMQrG7boSS8gJ+1gy4QVqe0SFjuLh0xVSRJVYatYXtU56hD1xi+9 wKbIkFT/fcYH/ReXKBuO6uD3PamO1Mjqn9z1XbyhZ19/EYlW5UOGeEcyVZpE9Osz1c9f 68of/mLTZZZZNtDVdNZcnxxbMd56OSNnLp7iwilVNqJdPG17CavxgfvUXD5h6EyNwVoI 2klw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680495091; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=27R2g+sDxLnJbDwWfWYA6YvPE6yIAlipgv7jbis7U+s=; b=CVIvB2e0klCo/p1iSJVL6+A/gUxwwd7L+7/NKaJRY8XZ3JMBuf5zcBTdomA90A6Alp OuEyRs66Z/2uD/kroTfwhKbRJ+y6A5OyinPf/OTplpV1nylzaUwEiwfKT4N796+A73nr BD2n8JIiSVBCwvcduL9zJZdmvQpaEaIfISCiL2sZ942pYR1JncEGFDUhycv3gUvjY4PE PuqkBQtdmimwGg4FRZ96cleqyGOU8RjywxzYCFe/7KUt9w1yDxN2HYMTBJW8H2s3fkUc I0BzYJAUGbcRdsvjSz5fACJS4M3tARdWISu5Z0yodNXfZGmoBvs27vLc6GXa6kt/MJGn KP6g== X-Gm-Message-State: AAQBX9coK9ZTYM2umdXcGBc+3zRmqACn+UriidTrg7zohRrwgpQqDDRp r5BR7JnNh36Y2MV61/amS6/rnQ== X-Received: by 2002:a17:90b:3a83:b0:23b:569d:fe41 with SMTP id om3-20020a17090b3a8300b0023b569dfe41mr39572506pjb.7.1680495091198; Sun, 02 Apr 2023 21:11:31 -0700 (PDT) Received: from localhost ([122.172.85.168]) by smtp.gmail.com with ESMTPSA id a17-20020a170902ee9100b0019edc1b9eb2sm5475303pld.238.2023.04.02.21.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 21:11:30 -0700 (PDT) Date: Mon, 3 Apr 2023 09:41:28 +0530 From: Viresh Kumar To: Yajun Deng Cc: rafael@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target() Message-ID: <20230403041128.jrsvbm4ddxdyhddg@vireshk-i7> References: <20230329133600.908723-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230329133600.908723-1-yajun.deng@linux.dev> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On 29-03-23, 21:36, Yajun Deng wrote: > __resolve_freq() may be return target_freq if policy->freq_table is > NULL. In this case, it should return -EINVAL before __target_index(). > > Signed-off-by: Yajun Deng > --- > drivers/cpufreq/cpufreq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index c0e5be0fe2d6..308a3df1a940 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -2299,7 +2299,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, > return cpufreq_driver->target(policy, target_freq, relation); > } > > - if (!cpufreq_driver->target_index) > + if (!cpufreq_driver->target_index || !policy->freq_table) > return -EINVAL; Hi, I have sent an alternate patch [1] for this, please try it. -- viresh [1] https://lore.kernel.org/all/53d4ed4e5b18a59a48790434f8146fb207e11c49.1680494945.git.viresh.kumar@linaro.org/