Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7187730rwb; Tue, 15 Nov 2022 08:44:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf7GiSOepZ43FvvaxG93SnkqBwLlTOyF1M1qWF7/WJ+NzXnRpyUj0TJ08yXySWbGFo3r67fK X-Received: by 2002:a50:e615:0:b0:461:ea0c:e151 with SMTP id y21-20020a50e615000000b00461ea0ce151mr15436362edm.376.1668530692494; Tue, 15 Nov 2022 08:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668530692; cv=none; d=google.com; s=arc-20160816; b=Mxf/tpDyxYtJJYUVQ93m61szdwJsxQ5Gzn4QnZ6Y6LkGpMu0aJdhbavBd1XYNkUZFp aZyI7qvV8LOPLkOrcxEYlluxMK6/MZCLCet+8a0Hc/WHEEbWzDeHfbizTABS059sjI0u qsbwyH5T9FTX/2+/ysDL8lqhWkecEa4HPdcy2QtV9lN+Ju9mF+VmID2lyakVvUUXz7XZ 62Uwhha2AZiq6jjoduwWz6vihArkUjA122uiFDuzn7Jd9IqaAd2L1vaPGG7uYhO1kbmj 3BWtGL6NR5hgG74aijv3hy/NQ8mAikX5iDjDwXyEZXAjSM5q12H9dPMLGuhNJmRW3tnb SRnQ== 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=bWe4UU0UXa8p1ABRwhll495O8D3qa/Pr4ibjParckTE=; b=APzSocRxv4DxTVMV6tDuNj9xF8aDEliowizNIm4VA0zCzF5tRdELbKZFpgVqm5hhU/ nTrj+mxysIIEre1sxrqNu9P+qNiYira/wpSL1bLaY+2rOZVEBBPZdTWU9aAuUXWacwpL QeERW0PHyTN896koY8pyl6cMFvpIwHNBWdM7umAbc6r9e469H7torbLiqZxMoctbqp+z qmdtgzQmsJygHXb44VMIbhBcIYzvpSuXANt70zYNfqS/SqAzFdPUv3NCC2Lw7VHMGzbR CJi4IQ2tOgxsmWW+kgX3vbiyNqqbuqV6kSG8AqKh8+6QJfSHAM7c1NRUDvZ3U+6wFRjB o8Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=rh+IRlUs; 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=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a509b41000000b00462e167b496si12475771edj.317.2022.11.15.08.44.30; Tue, 15 Nov 2022 08:44:52 -0800 (PST) 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=@lunn.ch header.s=20171124 header.b=rh+IRlUs; 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=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238530AbiKOPvV (ORCPT + 90 others); Tue, 15 Nov 2022 10:51:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiKOPvE (ORCPT ); Tue, 15 Nov 2022 10:51:04 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D3042E9C6; Tue, 15 Nov 2022 07:50:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=bWe4UU0UXa8p1ABRwhll495O8D3qa/Pr4ibjParckTE=; b=rh+IRlUscld/0QXEfEe/6f2zKh 002EbrLp0z3QjCY+nZM8h4VNyTCXJQQTDG3J8s9Wr/qAGat7umMF+Jr0unnLZn+Bd4tp9IUOPpRjy A2WrbkcQp6DBqccNrMqKOMXukbI1IhDM0Tj4QmNBz3UMpwIpoukl9egQ+rU8SzJJexfM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ouyD1-002TTk-Hy; Tue, 15 Nov 2022 16:50:47 +0100 Date: Tue, 15 Nov 2022 16:50:47 +0100 From: Andrew Lunn To: Hui Tang Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, mw@semihalf.com, linux@armlinux.org.uk, leon@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yusongping@huawei.com Subject: Re: [PATCH net v2] net: mvpp2: fix possible invalid pointer dereference Message-ID: References: <20221115090433.232165-1-tanghui20@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115090433.232165-1-tanghui20@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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 On Tue, Nov 15, 2022 at 05:04:33PM +0800, Hui Tang wrote: > It will cause invalid pointer dereference to priv->cm3_base behind, > if PTR_ERR(priv->cm3_base) in mvpp2_get_sram(). As i pointed out for the MDIO driver, i wonder if this is the correct fix. mvpp2_get_sram() is probably a better place to handle this In fact, please add a devm_ioremap_resource_optional() which returns NULL if the resource does not exist, or an error code for real errors, and make drivers fail the probe on real errors. Andrew