Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp59973imn; Wed, 3 Aug 2022 19:39:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR6y7HUl/hnHQvbOAFrqzJ0ECboa5DpUYuf/4Bb4K7HCc5aM5AXUqpCzuK+s1bdW2a5VTddh X-Received: by 2002:a17:907:9726:b0:730:9e04:f738 with SMTP id jg38-20020a170907972600b007309e04f738mr9249566ejc.631.1659580761651; Wed, 03 Aug 2022 19:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659580761; cv=none; d=google.com; s=arc-20160816; b=E4/EpYwSnQZ7dnANeXpP3Yj0FCesdYvLtyF9LDU3Y6FLHY15FrIs4zkGOfcDau9Hn7 C+7vEBkVC5WdlXdtx3UTB+U2rOpkj0kATy2Ur7LZ1QULpblA0F7tlGZqhQbDSx+mgssU L7hXCY8bIcElwoGeVWfhsMlmZbTF92TyDQrZ2AM1odBVbEqNXOxylRVCBbZzBsDvKP5k irLVrdUGHSzbQ7mayYpt0gVCVqDIIsVi4ELLkaZ9pMZInUvrdgN9lFiCPae95xgf+R4A 6NgTdHZi5JZm7UFsbW3tTFQM+1fRZcOmiVKzOIm4hC8bnqftQc726fzGKXiiMgUolave cUVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=wx5puFNKG/yNt3upo3mqTE/6CqK4X57dJq2ZdrOYXjI=; b=vSf9Z7bOprkv9Sn0AdDPe3JOtHBQcLGWFLs+Rz5wDhfeZ+Z7MKQgJrIzOqqKhrD7+8 tqW2dCQ9b11iGt17Bi1+1SK5pNtwKrVjHGNwGDXAXp+87qQNX8xLycgNZFZjfTCtvapr RJW+JVFrH2TPfhbcnEbAarPNbEPobaQPuvSDMyywUAhem6uVLdE1MtkgyUHqaUybuTWE VDBVMIRp9aL0om8PBEZAJ3oLn+O3pZL04h5nB8pJkiiohf29KvwiDcqI0kFBqVtMi+DS jftrwHVcD3346iXJnqgvheCYp7W/rIMlytBwoGoCpyk68J8Tej2VTUa6gCVZCNpgnv5n 1MCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=log592zb; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020aa7d1d4000000b0043a7cdf26aasi14920504edp.85.2022.08.03.19.38.56; Wed, 03 Aug 2022 19:39:21 -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=@kernel.org header.s=k20201202 header.b=log592zb; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238965AbiHDC3j (ORCPT + 99 others); Wed, 3 Aug 2022 22:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbiHDC3h (ORCPT ); Wed, 3 Aug 2022 22:29:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA83A11A14; Wed, 3 Aug 2022 19:29:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 65CF5B82443; Thu, 4 Aug 2022 02:29:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D6CC433D6; Thu, 4 Aug 2022 02:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659580173; bh=95WjuixEmtHqhYyk/ABrqWxCLjjTXMoyiH05pW4cDXs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=log592zbAttTQGaPBe/B5hf6vBENLIjZf5kNZ6TnkfmDarOI47TqHdPRjQPhPK5HG yWcDekPTUQSrB2TtxeVw2Nm7mC4aSIutboh73vb91Re9Shr2ts1CqL0OEza5LZbFO6 4x2573IdVvA2/FK4DFKqBbgkAR8n/+LbwolqdNQqBR1IXk9Wf/wWmRhpxbEoZ5d0rk nYBFKJFdymy0jJFo/Qu+1b6KPlumTtD7UsDYQUrjFZytRqJeS5WuQxuhtjB6GKsxkK cCDvP+hnblhw4KuzRaeBQTE+QMdvdc7SdSBReN6EudyOFpZ8Qwlm63tbq/1pQayOUC LVPb8HemVkNXg== Date: Wed, 3 Aug 2022 19:29:31 -0700 From: Jakub Kicinski To: studentxswpy@163.com Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Hacash Robot Subject: Re: [PATCH] net: check the return value of ioremap() in mhz_mfc_config() Message-ID: <20220803192931.52900f69@kernel.org> In-Reply-To: <20220802072826.3212612-1-studentxswpy@163.com> References: <20220802072826.3212612-1-studentxswpy@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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, 2 Aug 2022 15:28:26 +0800 studentxswpy@163.com wrote: > From: Xie Shaowen > > The function ioremap() in mhz_mfc_config() can fail, so > its return value should be checked. > > Fixes: cdb138080b781 ("pcmcia: do not use win_req_t when calling pcmcia_request_window()") The check seems fine, but that's not the commit which added the ioremap() without checking the result. You need to find the fix commit in the git history where the bug exists, not just run git blame on the line in question. > Reported-by: Hacash Robot > Signed-off-by: Xie Shaowen > --- > drivers/net/ethernet/smsc/smc91c92_cs.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/ethernet/smsc/smc91c92_cs.c b/drivers/net/ethernet/smsc/smc91c92_cs.c > index 37c822e27207..14333f5bdcdc 100644 > --- a/drivers/net/ethernet/smsc/smc91c92_cs.c > +++ b/drivers/net/ethernet/smsc/smc91c92_cs.c > @@ -446,6 +446,8 @@ static int mhz_mfc_config(struct pcmcia_device *link) > > smc->base = ioremap(link->resource[2]->start, > resource_size(link->resource[2])); > + if (!smc->base) > + return -ENOMEM; > offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0; > i = pcmcia_map_mem_page(link, link->resource[2], offset); > if ((i == 0) &&