Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6312700ybc; Wed, 27 Nov 2019 19:44:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzZNyqq5r6Op1Wagb/A07kyoxM5ws0s56NCLNqX+vCfPud+Gf0hZVhgAdsNlRtilI2a351T X-Received: by 2002:a50:f296:: with SMTP id f22mr35903297edm.26.1574912669553; Wed, 27 Nov 2019 19:44:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574912669; cv=none; d=google.com; s=arc-20160816; b=CghALxiUf/pC6aYqd4v+sib3z/6fA6N2whPbpOdea7x2+2xSEANkiaejW/1Wkk9LuC aESHzS+0Io/8by6JQtZk9/8wVbzYLhuL5qqGa6a+FEZCRcMseUXtmdMAKPp8sMec8i6T e/CPdGl6vM4jTH5NChwNqTwsO+uwdjtoV5ATkb0VwO5FQc9o6EIQ8tIuwEh+I0MvVqD+ BW9Vn4nF5IpckucBO/1vk4E97zcyv521DETYkxPo7BJ3/+E6b3F3SgNk6vEmt/v5sIB4 Kwdi4aJAIsV9T9WKOCyPWv7Sv/Xk6S/hT8eLIKkN1dDo4wqBxZa8+tT3v1KUvkHW+Yp0 wbIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=hJ2VRlsL6crdsCHdgOGXRZIVdcIk0/c7tuQ3jFSWS8k=; b=r+kf6kRj7yUY5nshujC+ZiC+dTMBhwGsksNs05mXY6ZGLlaNPm6FFoY0xRHLfrOIQL TW6KWzOtNwwcvQN60l5HN5um1QcF/v33Qsv2Sj4UT3mwDMGG7J1LPyN3rqz6fraFj3F1 89DK9PpzzYpfhxm7lZ2DShCdtL7lajNBakCmUm50XQgbg7rPsL5b8T924323lR5x7ouJ oK5wDr+P+vle+rjrVP11KA8vGL/1X1st1NiStKAr8b3AeSY4B3g6ySx2Fu3QWUxBdkH4 VI4WkbdVzR9vezFJULPABRxsue2YIcJ2o7NzpwN+ii/i6uYeWcL61Xn9lninbQdsvAVN of6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay20si2180794edb.62.2019.11.27.19.44.02; Wed, 27 Nov 2019 19:44:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727187AbfK1Dkl (ORCPT + 99 others); Wed, 27 Nov 2019 22:40:41 -0500 Received: from mo-csw1514.securemx.jp ([210.130.202.153]:33634 "EHLO mo-csw.securemx.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727133AbfK1Dkl (ORCPT ); Wed, 27 Nov 2019 22:40:41 -0500 Received: by mo-csw.securemx.jp (mx-mo-csw1514) id xAS3eOPY017112; Thu, 28 Nov 2019 12:40:24 +0900 X-Iguazu-Qid: 34trMIO5KQvAymG4rS X-Iguazu-QSIG: v=2; s=0; t=1574912423; q=34trMIO5KQvAymG4rS; m=2JADXTo0a0DwfWBCaayqVuS6YitGzMqN7fwhpDEKbUg= Received: from imx12.toshiba.co.jp (imx12.toshiba.co.jp [61.202.160.132]) by relay.securemx.jp (mx-mr1511) id xAS3eMrq024465; Thu, 28 Nov 2019 12:40:23 +0900 Received: from enc02.toshiba.co.jp ([61.202.160.51]) by imx12.toshiba.co.jp with ESMTP id xAS3eMMo015989; Thu, 28 Nov 2019 12:40:22 +0900 (JST) Received: from hop101.toshiba.co.jp ([133.199.85.107]) by enc02.toshiba.co.jp with ESMTP id xAS3eLkL032028; Thu, 28 Nov 2019 12:40:22 +0900 Date: Thu, 28 Nov 2019 12:40:20 +0900 From: Nobuhiro Iwamatsu To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Dan Carpenter , Enric Balletbo i Serra , Chanwoo Choi , MyungJoo Ham , Sasha Levin Subject: Re: [PATCH 4.19 216/220] PM / devfreq: Fix static checker warning in try_then_request_governor X-TSB-HOP: ON Message-ID: <20191128034020.necma5gpnf2wgsm4@toshiba.co.jp> References: <20191122100912.732983531@linuxfoundation.org> <20191122100929.173069944@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191122100929.173069944@linuxfoundation.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Nov 22, 2019 at 11:29:41AM +0100, Greg Kroah-Hartman wrote: > From: Enric Balletbo i Serra > > [ Upstream commit b53b0128052ffd687797d5f4deeb76327e7b5711 ] > > The patch 23c7b54ca1cd: "PM / devfreq: Fix devfreq_add_device() when > drivers are built as modules." leads to the following static checker > warning: > > drivers/devfreq/devfreq.c:1043 governor_store() > warn: 'governor' can also be NULL > > The reason is that the try_then_request_governor() function returns both > error pointers and NULL. It should just return error pointers, so fix > this by returning a ERR_PTR to the error intead of returning NULL. > > Fixes: 23c7b54ca1cd ("PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.") > Reported-by: Dan Carpenter > Signed-off-by: Enric Balletbo i Serra > Reviewed-by: Chanwoo Choi > Signed-off-by: MyungJoo Ham > Signed-off-by: Sasha Levin The following commits are provided for this fix: commit 7544fd7f384591038646d3cd9efb311ab4509e24 Author: Ezequiel Garcia Date: Fri Jun 21 18:39:49 2019 -0300 PM / devfreq: Fix kernel oops on governor module load A bit unexpectedly (but still documented), request_module may return a positive value, in case of a modprobe error. This is currently causing issues in the devfreq framework. When a request_module exits with a positive value, we currently return that via ERR_PTR. However, because the value is positive, it's not a ERR_VALUE proper, and is therefore treated as a valid struct devfreq_governor pointer, leading to a kernel oops. Fix this by returning -EINVAL if request_module returns a positive value. Fixes: b53b0128052ff ("PM / devfreq: Fix static checker warning in try_then_request_governor") Signed-off-by: Ezequiel Garcia Reviewed-by: Chanwoo Choi Signed-off-by: MyungJoo Ham Please apply. Best regards, Nobuhiro