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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21963C433EF for ; Sun, 24 Apr 2022 06:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238350AbiDXGYG (ORCPT ); Sun, 24 Apr 2022 02:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235842AbiDXGYE (ORCPT ); Sun, 24 Apr 2022 02:24:04 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0186C2AC47; Sat, 23 Apr 2022 23:21:01 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KmJ1F5JzHzhYCv; Sun, 24 Apr 2022 14:20:49 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sun, 24 Apr 2022 14:20:59 +0800 Received: from [10.174.178.174] (10.174.178.174) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sun, 24 Apr 2022 14:20:59 +0800 Subject: Re: [PATCH 00/20] hwmon: check return value after calling platform_get_resource() To: Guenter Roeck , , CC: References: <20220422091207.4034406-1-yangyingliang@huawei.com> <3896f884-56d9-d0d9-efe6-839c7431e6de@roeck-us.net> From: Yang Yingliang Message-ID: <8355e6fe-0271-eba1-c256-a5582a8e01f9@huawei.com> Date: Sun, 24 Apr 2022 14:20:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.174.178.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/4/24 12:54, Guenter Roeck wrote: > On 4/23/22 20:35, Yang Yingliang wrote: >> Hi, >> >> On 2022/4/22 21:27, Guenter Roeck wrote: >>> On 4/22/22 02:11, Yang Yingliang wrote: >>>> This patcheset add check after calling platform_get_resource to >>>> avoid null-ptr-deref >>>> in drivers/hwmon/. >>>> >>>> Yang Yingliang (20): >>>>    hwmon: (abituguru) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (abituguru3) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (dme1737) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (f71805f) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (f71882fg) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (it87) check return value after calling >>>> platform_get_resource() >>>>    hwmon: (lm78) check return value after calling >>>> platform_get_resource() >>>>    hwmon: (nct6683) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (nct6775) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (sch5627) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (sch5636) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (sis5595) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (smsc47b397) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (smsc47m1) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (via686a) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (vt1211) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (vt8231) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (w83627ehf) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (w83627hf) check return value after calling >>>>      platform_get_resource() >>>>    hwmon: (w83781d) check return value after calling >>>>      platform_get_resource() >>>> >>>>   drivers/hwmon/abituguru.c  | 6 +++++- >>>>   drivers/hwmon/abituguru3.c | 6 +++++- >>>>   drivers/hwmon/dme1737.c    | 2 ++ >>>>   drivers/hwmon/f71805f.c    | 2 ++ >>>>   drivers/hwmon/f71882fg.c   | 6 +++++- >>>>   drivers/hwmon/it87.c       | 2 ++ >>>>   drivers/hwmon/lm78.c       | 2 ++ >>>>   drivers/hwmon/nct6683.c    | 2 ++ >>>>   drivers/hwmon/nct6775.c    | 2 ++ >>>>   drivers/hwmon/sch5627.c    | 6 +++++- >>>>   drivers/hwmon/sch5636.c    | 6 +++++- >>>>   drivers/hwmon/sis5595.c    | 2 ++ >>>>   drivers/hwmon/smsc47b397.c | 2 ++ >>>>   drivers/hwmon/smsc47m1.c   | 2 ++ >>>>   drivers/hwmon/via686a.c    | 2 ++ >>>>   drivers/hwmon/vt1211.c     | 2 ++ >>>>   drivers/hwmon/vt8231.c     | 2 ++ >>>>   drivers/hwmon/w83627ehf.c  | 2 ++ >>>>   drivers/hwmon/w83627hf.c   | 2 ++ >>>>   drivers/hwmon/w83781d.c    | 2 ++ >>>>   20 files changed, 55 insertions(+), 5 deletions(-) >>>> >>> >>> This series solves a problem which does not exist in reality and is >>> only theoretic. >>> The devices are instantiated from their init functions which always >>> adds the resource. >>> Please do not submit such patches. >> As you said the resource will be add in init functions, I checked >> these drivers, the driver >> sch5627 and sch5636 won't add resource, so need I send patches to fix >> these drivers ? >> > You might want to read the code more carefully. The drivers are > instantiated > from drivers/hwmon/sch56xx-common.c which does add the resource. Yes, it does, thanks for pointing it out. > > Guenter > > .