Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp341316iob; Thu, 28 Apr 2022 03:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnhiS5ZWf1n9lIPnhxx3r1l2UorHKKvmzpsqisbK6YVwe1WBxI5Omele07aKrIxkluCaUN X-Received: by 2002:a17:903:11c7:b0:151:9769:3505 with SMTP id q7-20020a17090311c700b0015197693505mr32619481plh.72.1651142983740; Thu, 28 Apr 2022 03:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651142983; cv=none; d=google.com; s=arc-20160816; b=PZOSLWU0IjjFqoPcKTlTAnRzs7GcREN7QNOj4I9T/3S6YkRhFUHPfbhGM12gZo672h TmokmIDupm1/GFqHElPLerGvNmqUs09qlRyK0pvhgmJjSEXKTdpHUe3cFIsPQbmrEaAK ZRq7bRBjCOl+tkabbRJEErmyILD1kZohtyio3WeW8qIseGAHqJSj0jETDGSHUOMpHqlH LJjDMlBv+M0EfY9iMNpSP2NyyJok/WdNL2TWWac3d0pjKyJ/rhAs0SukJ7wT0SH0g4rt SlF8FVhN9OfgF10oVp1JfVBVDxRozdp1+9FeCM2216HW+zKtorC9eh8bglDlDV+XB1iy VzXg== 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; bh=CiuREl8uM4sjVedIs63FyJoJvleAGjMFtc7cv/Jff+I=; b=fxR6XUNUXrOtE2S3hssxmVFN5SDjfPAGUVDB0f97Hisccl4xraEfG8LP1PnMdxw+Zd gzge1isvGYhbkEp5SSCldOSY7ooW/D4pwbOF3GvjQzQxGTM6CFC1rfYkeAMCUgwK6x3c FWXPbkBrQ7UzURoS4AmdwTdNf2VpyRX+HKJBrM+AIDN5TwxehUKmTgOMDPcwsqcgW+5U DiiZAudBeXgOsTs5huDRVXkaYqP1m3/V5A1/SvOf4SNtY8vjbEtpIsSChqoHBF9L5Ywa eYBDOU3sQ0DW7ADZqQFUvvv8UsFXLPZK8e5xx3Kg3Ys3Q2dAsRjYx+yJyVRtlY7gcXqN 7k+w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a170902eb8b00b0015854351df5si3947887plg.204.2022.04.28.03.49.28; Thu, 28 Apr 2022 03:49:43 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232480AbiD1Jw0 (ORCPT + 99 others); Thu, 28 Apr 2022 05:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348882AbiD1JmT (ORCPT ); Thu, 28 Apr 2022 05:42:19 -0400 Received: from theia.8bytes.org (8bytes.org [81.169.241.247]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8D4D972B8 for ; Thu, 28 Apr 2022 02:39:05 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id 46ED12FB; Thu, 28 Apr 2022 11:39:04 +0200 (CEST) Date: Thu, 28 Apr 2022 11:39:03 +0200 From: Joerg Roedel To: Yang Yingliang Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, will@kernel.org, alyssa@rosenzweig.io, sven@svenpeter.dev Subject: Re: [PATCH] iommu/dart: check return value after calling platform_get_resource() Message-ID: References: <20220425090826.2532165-1-yangyingliang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220425090826.2532165-1-yangyingliang@huawei.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Mon, Apr 25, 2022 at 05:08:26PM +0800, Yang Yingliang wrote: > It will cause null-ptr-deref in resource_size(), if platform_get_resource() > returns NULL, move calling resource_size() after devm_ioremap_resource() that > will check 'res' to avoid null-ptr-deref. > And use devm_platform_get_and_ioremap_resource() to simplify code. > > Fixes: 46d1fb072e76 ("iommu/dart: Add DART iommu driver") > Signed-off-by: Yang Yingliang > --- > drivers/iommu/apple-dart.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) Applied to iommu/fixes, thanks.