Received: by 10.223.176.5 with SMTP id f5csp1214849wra; Tue, 6 Feb 2018 15:00:43 -0800 (PST) X-Google-Smtp-Source: AH8x225ojEwPH1hiJkGUvJob1B+n9Du8i70l3wcFO5GP00ZvTHfis1HWt6z2oZObydfzf2FKIwYF X-Received: by 10.98.215.94 with SMTP id v30mr3942054pfl.106.1517958043662; Tue, 06 Feb 2018 15:00:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517958043; cv=none; d=google.com; s=arc-20160816; b=gbzBADVeGpHsTu3lb4qilrtOvDwM7vh8ScsIpDt5dcctC43eXppDc8cYKznjE1vcFw mj92hyUo+QJoxu3ZpHIvZfdHtq2ONg2yu4wmqOu8xNuXagMv2jWybfLHc0SUcoTuiWol TQX42AAvDoeZ1gKDGdJScyEbDywvwO6GzvVIeq+y08tRp1z3uTP6uDxoGvrMPEqmYtWK natDmcZvnVBI8I7KmyWsZIxBdbUhwmT93XBkGNUFmKUXcPUo27xjyGZwP/drCQ/Ajkwy ZyVXmvPG+hnCJz3qmESL7X2M8IstZEKRCAeZgrb2sCvAJHEKrppNBHBrWqQ6Hmt8Wx9X CQMA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=ORDG4cFFJsyDHJFP2ocA+48A0US0+rYuZmnJ1s6JiXE=; b=n6vglFJYKrkCa87QPjlMPMvBl0a8JRev05qVqouGWG7+5uQOnRsx3xBDmtgIgH8nP4 h2lQ8/cRsbqb2SKMQT7+BptteUw+YbC5dS86qTIIRbmTx3/ipbMTcPtAjBDTks3q/rTH vudLmVAoMHwdQe4fsJhpslWEqZjs6Y+i+fC7caqkPPLkmjasqtCzVZ/MUPpBz3weZOXa Py9IzKV9MOxcPMVH7tk+/rKiA4Db3eCrLQlZWKII8p+THUG3Xrwl1Z9B8mCcL0XuVmRs S1kMSRn4mnSSgBebrr9PKxo3/jXN+taORqAzBN+e2UGEzXiyOGsnM6okve+aGwaeySD7 nQNA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si63229pfk.415.2018.02.06.15.00.28; Tue, 06 Feb 2018 15:00:43 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753781AbeBFW7y (ORCPT + 99 others); Tue, 6 Feb 2018 17:59:54 -0500 Received: from mail-oi0-f66.google.com ([209.85.218.66]:45254 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753604AbeBFW7x (ORCPT ); Tue, 6 Feb 2018 17:59:53 -0500 Received: by mail-oi0-f66.google.com with SMTP id c189so2620260oib.12 for ; Tue, 06 Feb 2018 14:59:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ORDG4cFFJsyDHJFP2ocA+48A0US0+rYuZmnJ1s6JiXE=; b=Rd6KiNaRj5fGuaKXlL2BlUcjc3sWi2fVlST/Y/CjDEsBqe6JUKPonJEbBQGlS+Rpw0 OixJsCCiPAAINHQAdKgc3F2U2pUII8JpQaUPNXekjmfkAguUThD1Epcp8CK8d7gzVhfq R835MxT0LuijtlM9KbDaejlEUTXt1m+1dhS3Jsh6qnM0yghTiOZji8tc85IvQCPCi/VF yxn3vGtWNPOaXxxchvrAHFwa7k8iYmcnTewcU11UYkdy5xBHCvcIfoprdSRPOYlHtiJZ mQLArU3ULYfXxvaAGnIj+DKZ8dD8o0Qy4+QxPQIoiALqoCIyxoKkhI/aoYlLpr+VzdO4 6Qrg== X-Gm-Message-State: APf1xPAB/stnACampSSwtiHJW54sKxOEBhBufxkHGTVsCuramqTIv8AS HCSNjD0QkHZdiiQc3kf9YKUsshaD5uA= X-Received: by 10.84.64.2 with SMTP id x2mr2382100oie.10.1517957992189; Tue, 06 Feb 2018 14:59:52 -0800 (PST) Received: from ?IPv6:2601:602:9802:a8dc::f21a? ([2601:602:9802:a8dc::f21a]) by smtp.gmail.com with ESMTPSA id 20sm40400otf.71.2018.02.06.14.59.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 14:59:51 -0800 (PST) Subject: Re: [PATCH 1/2] staging: android: ion: Avoid NULL point in error path To: Yisheng Xie , gregkh@linuxfoundation.org Cc: sumit.semwal@linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org References: <1517488447-41252-1-git-send-email-xieyisheng1@huawei.com> From: Laura Abbott Message-ID: Date: Tue, 6 Feb 2018 14:59:49 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1517488447-41252-1-git-send-email-xieyisheng1@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/2018 04:34 AM, 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. > Acked-by: Laura Abbott > 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++; >