From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17F32C433E0 for ; Thu, 7 Jan 2021 16:40:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D39BA23403 for ; Thu, 7 Jan 2021 16:40:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728060AbhAGQkR (ORCPT ); Thu, 7 Jan 2021 11:40:17 -0500 Received: from mail-ot1-f44.google.com ([209.85.210.44]:40679 "EHLO mail-ot1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbhAGQkQ (ORCPT ); Thu, 7 Jan 2021 11:40:16 -0500 Received: by mail-ot1-f44.google.com with SMTP id j12so6821138ota.7; Thu, 07 Jan 2021 08:40:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6f15dDz/sBid4bA08/uLFiWT+A9f5KxxTm6Kjvrbx5o=; b=r97fbXAkSfFvW7v31pbLgEytAiwCyhDS51c0lp4rEVvQUZmnzoWbBrDC5F4Umnx1pd Yw0e+sCE5ru9K/hnzm2q/p8hfjpyJgAFJnwTspvYGIX6U42g2F8fv8wkt6gUylhWT9qh aThDZkFWK3tJ1C+/ImC/eFLromXhkGX6Vl13GEe0aVsr5QIPHk++u8lo1pYj37Z9E5VX +TUsYlZEKazRlECUoeaIoo02r7DJIZ1VmjbI9Z3JqXSSGS3p7Ls0CCB8rDuh0Rc20Px1 Kp1kcXGnL5f58OwCd11NOYxumUxsZLOM6rPYr4U9S6CFs1U75OVclPxhLLwI9qfipcLA 8Dyw== X-Gm-Message-State: AOAM533opNkbbghwf4Hkieq3xnsl3vyZ2OkXDESLd3qxBBH92/1rhS6V +L/DlrP5TsUIYY8+5gHaGuz0h+zpGDwUo/ecRCo= X-Google-Smtp-Source: ABdhPJyRCd+XcKa12I5Zg+gyy1RnqAUd0zOrCx8YgJzzFAyySoyWiJ2m+CdecnCaGOeHVUXx+emZxEUWfFIS7uirqiw= X-Received: by 2002:a9d:67da:: with SMTP id c26mr7245123otn.321.1610037575690; Thu, 07 Jan 2021 08:39:35 -0800 (PST) MIME-Version: 1.0 References: <20210105101957.59072-1-colin.king@canonical.com> <20210105102101.y4jdqdmcru5ouec4@vireshk-i7> In-Reply-To: <20210105102101.y4jdqdmcru5ouec4@vireshk-i7> From: "Rafael J. Wysocki" Date: Thu, 7 Jan 2021 17:39:24 +0100 Message-ID: Subject: Re: [PATCH][V3] cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get To: Viresh Kumar , Colin King Cc: "Rafael J . Wysocki" , Stephen Warren , Linux PM , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 5, 2021 at 11:22 AM Viresh Kumar wrote: > > On 05-01-21, 10:19, Colin King wrote: > > From: Colin Ian King > > > > Currently there is an unlikely case where cpufreq_cpu_get returns a > > null policy and this will cause a null pointer dereference later on. > > Fix this by passing the policy to transition_frequency_fidvid from the > > caller and hence eliminating the need for the cpufreq_cpu_get and > > cpufreq_cpu_put. Thanks to Viresh Kumar for suggesting the fix. > > > > Addresses-Coverity: ("Dereference null return") > > Fixes: b43a7ffbf33b ("cpufreq: Notify all policy->cpus in cpufreq_notify_transition()") > > Signed-off-by: Colin Ian King > > --- > > > > V2: pass the policy to transition_frequency_fidvid rather than add > > a null pointer check on the return from a cpufreq_cpu_get call. > > V3: update subject line to match the fix > > > > --- > > drivers/cpufreq/powernow-k8.c | 9 +++------ > > 1 file changed, 3 insertions(+), 6 deletions(-) > > Acked-by: Viresh Kumar Applied as 5.11-rc material, thanks!