Received: by 10.223.176.5 with SMTP id f5csp2695277wra; Thu, 1 Feb 2018 04:44:23 -0800 (PST) X-Google-Smtp-Source: AH8x227MIfHNYp7fbIDmNBgFYv90sveEhXCSJ5neh0bf8sOLRiRKxymNkm0ZzrRftJAMwtn9LvRq X-Received: by 10.99.110.200 with SMTP id j191mr26060241pgc.348.1517489063399; Thu, 01 Feb 2018 04:44:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517489063; cv=none; d=google.com; s=arc-20160816; b=Tpk9iqknKIBorEbfdpyVrJ2zc3baC0md1iAOfaU8IBAOTNY7Co3FXnyK+LJ9S+F/nJ xwUO7Hys/7P45a7t4wkFimpQXOz45njWl5lInQTlrj5Uc6N7zxN3B+0y1uPfb5n2Gest UoddQGZ6lMDybEX+oioaiRDKMNaAdaVa4PKFHeqkxRh3NcMKVOxTd+v6P7Bg2qAuBUGg APK6NpBhmNkH828M7dkBW30SUk/YuiTNaPGJUQOJXOdG2Q/Nh/QJxtWjz0lhCAWufyiS wassmLGhgODnUMZIYPVrDo9IcCdZVpEjCzvbE8pLuWbtaHsUJrZ7+TNVI/derxQVrWvz XBeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=4L1QBBk6dONFFW5IUSuEf4c7SW+lkbDOiSJe1Tvx0eE=; b=EffZunTEpxa6Hh7UX2iZGh46JWS6astptBTKoZhKUhn1gF0M/w+TjB7CiJqagu4MfN bwwo1RDJiTIAQZ/ngJD0sMcGCnBBAusucjGK9FVNR+9etf3iJFbGooQ41w/3idGQB5jK D3aDCRgBzK9ryQji/vjCxVSjC/LQ1ShvYkYYdI6oenqfnFUgX4Ihlt9moSqawDXIMAI+ q+4i0mxDlhAjDqe0WjZoWXZ93Cla9IMZC5IXN1ZeznfXAti806hKZwSRx0YBXp5ViX8w BejtS0G9CQhCsSl6Pvi4iyFa9rcILM6aIQckH/BzO22xIyPvmkZnvDmMjcGk5QKfcrs7 7C7w== 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 r2si1209531pgt.507.2018.02.01.04.44.07; Thu, 01 Feb 2018 04:44:23 -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 S1752573AbeBAMnh (ORCPT + 99 others); Thu, 1 Feb 2018 07:43:37 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:5164 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752338AbeBAMng (ORCPT ); Thu, 1 Feb 2018 07:43:36 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 34148C41E0757; Thu, 1 Feb 2018 20:43:22 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.361.1; Thu, 1 Feb 2018 20:43:14 +0800 From: Yisheng Xie To: CC: , , , , Yisheng Xie Subject: [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Date: Thu, 1 Feb 2018 20:34:06 +0800 Message-ID: <1517488447-41252-1-git-send-email-xieyisheng1@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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++; -- 1.7.12.4