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 EE0E5C433EF for ; Thu, 28 Apr 2022 09:49:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231398AbiD1Jw1 (ORCPT ); Thu, 28 Apr 2022 05:52:27 -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> 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.