Received: by 10.223.185.116 with SMTP id b49csp2156129wrg; Mon, 12 Feb 2018 05:22:45 -0800 (PST) X-Google-Smtp-Source: AH8x224p4P3eUPcAc8Pcejm6QnBfz2Qd3mgcUQcqtErD7V0UBhnnTlyaQckeeVCMG0RYDGEO2TX7 X-Received: by 2002:a17:902:34f:: with SMTP id 73-v6mr1447651pld.55.1518441765655; Mon, 12 Feb 2018 05:22:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441765; cv=none; d=google.com; s=arc-20160816; b=Fl2HSzXBlEGkB2KbY4TYzXqvEXvL0ZLQQ0kFVBe9NzZwN/6ZDopkvDbBrkS9OsEavy gTOYb46oSnuHsTKP0RhD6+azxDfe9c41/cYHO0OnZfVs5sOi4VpyTIYWyA8ocloG8i7X X06qhiWjb0Yu4EYrFmLtYZ/RIAqMTBXu4Y0c6i7SNEbs+KreCdO43rB1vBUt2eEW5eTM ZztVMM61wA1iLxoxnx4y2WS7JrUr3aQsEaxvRy1LwyL6xTo+vcwfEvi4nhgtlRXobOeD /HXtiA7GIKccV2LoSs0+gYNyMdg+tjkkPIHzFseUzvmCy1tSPqPCTQXYqF4Br3np3q0x DHIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=e5nN/cl6sqrMGYeRMNifj3p89aYfo4qMu/7hqYh++O0=; b=rkLvvWAp6PUxkUDQENQDczVcWxKL4+PcTvb+HagKYN03jXtLhgZnRRPlMXhO/DHoEk HiFC6TSFdQczASwb6iw3o/FBzE0iKC4f6wdDVALqBYOkY3Rd3e0WoqXBiAbcjFaTjP9V lLfgVpN263m4O/EBVguXN6pz0dFGSwbSzPp6acpSX50wLo/IIb2DPYBgEatLDk7+n9Yc p4JeFkx18croS3hC1RHNdymZXRm3uGRoW5KnbdBZrUAY/mtfuQ0PHTRV0CZWgiIM9+fx 2AnWOSJGA+nGti61UhDery64oCDKh4oqrjVN/TsGY6/b5CFaSXtWi97AokV8CAiqBP4+ DS2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si5147098pgn.504.2018.02.12.05.22.31; Mon, 12 Feb 2018 05:22:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754115AbeBLLlN (ORCPT + 99 others); Mon, 12 Feb 2018 06:41:13 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5224 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754084AbeBLLlM (ORCPT ); Mon, 12 Feb 2018 06:41:12 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 42BBFB5CF297E; Mon, 12 Feb 2018 19:40:58 +0800 (CST) Received: from [127.0.0.1] (10.177.29.40) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.361.1; Mon, 12 Feb 2018 19:40:58 +0800 Subject: Re: [PATCH 1/2] staging: android: ion: Avoid NULL point in error path To: References: <1517488447-41252-1-git-send-email-xieyisheng1@huawei.com> CC: , , , From: Yisheng Xie Message-ID: <1ac2eea4-83ef-d170-f115-7ce8e5d7503c@huawei.com> Date: Mon, 12 Feb 2018 19:40:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1517488447-41252-1-git-send-email-xieyisheng1@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, JFYI, I have rebase this patchset to v4.15-rc1.[1] [1] https://lkml.org/lkml/2018/2/12/204 Thanks Yisheng On 2018/2/1 20:34, Yisheng Xie wrote: > If we failed to create debugfs for ion at ion_device_create, the > debug_root of ion_device will be NULL, and then when try to create debug > file for shrinker of heap it will be create on the top of debugfs. If we > also failed to create this the debug file, it call dentry_path to found > the path of debug_root, then a NULL point will occur. > > Fix this by avoiding call dentry_path, but show the debug name only when > failed to create debug file for shrinker. > > Signed-off-by: Yisheng Xie > --- > drivers/staging/android/ion/ion.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c > index f480885..3e41644 100644 > --- a/drivers/staging/android/ion/ion.c > +++ b/drivers/staging/android/ion/ion.c > @@ -570,13 +570,9 @@ void ion_device_add_heap(struct ion_heap *heap) > debug_file = debugfs_create_file( > debug_name, 0644, dev->debug_root, heap, > &debug_shrink_fops); > - if (!debug_file) { > - char buf[256], *path; > - > - path = dentry_path(dev->debug_root, buf, 256); > - pr_err("Failed to create heap shrinker debugfs at %s/%s\n", > - path, debug_name); > - } > + if (!debug_file) > + pr_err("Failed to create ion heap shrinker debugfs at %s\n", > + debug_name); > } > > dev->heap_cnt++; >