Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1226755imu; Wed, 16 Jan 2019 15:12:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ywveRBSLYXDEK5HMW0A9zwe2oAiyb53N6+6i9e7bWXN7dIWOb8w2gXuduo/Eq7wbBUs7d X-Received: by 2002:a17:902:887:: with SMTP id 7mr12381894pll.164.1547680323160; Wed, 16 Jan 2019 15:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547680323; cv=none; d=google.com; s=arc-20160816; b=bLeF4+vWKNTOTKaDjfzs9mrmpZZUPZrkI74cC66wCk6KI995GhnLO39AwOH0rn/4kW X9d5InYMB3ONDLRD/sAGk+q9O89vVcS89FrnDO4QrBz640ewz/H7BVCmH01aSOue/JQ4 BQLvrpjTi4RxafZA09r7gZC9AzqmKLNzAy9J+3vJ7sVr1LEOvEIcNBBwDBWy9lww2CA/ QRGofeJLvuAlx0vN4oBF2vvwzjk9IwYplseivxjEwi2oDwGcUkqdr1Ozf3BCC48ZqgSP rRC3ClttFlCxl72xZpJxTkYOYcydOuTkpQiif66XzmSxYkfABrZeYwP6DlRY9XspZ4Ow Mmmw== 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:dkim-signature; bh=9yh5RvztSaWujiBz6b5nKhFLd6k2r4HHS60blovpu98=; b=xNmV+bYl+5bgkf14Hmy//znSjBNjJEreI8zOB8vSYTen6QN91LUuxNvz8kzIcd5SKk LVe5oGJlyNQOovfG+8zKBhwJJ21iAwnNxfj1wQpgRJlZNmrbOaTVmgkWC/Vbp9GjL85Z nvaO6slPM7Eeuau/rqvtluYEsJyaIMmILmAIGwPbBYXvPQmUs9U+DMT/q2atTNYfQYS1 HD14A3IdJxQ4S336PSpIPCZ5t6r/2o3xFJpPEN6uFGpteLNNR7/7309C+ThOyDP73m2w lfFE8kNSz/3AdKBATEDaUokQjANxvAUWVfcK5/VzebNkAN68M4TD6mAbGkz8uSE+89xP qIkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=GTP5qre6; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j12si6724017pgq.26.2019.01.16.15.11.46; Wed, 16 Jan 2019 15:12:03 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=GTP5qre6; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405883AbfAPRMj (ORCPT + 99 others); Wed, 16 Jan 2019 12:12:39 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:55410 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727430AbfAPRMj (ORCPT ); Wed, 16 Jan 2019 12:12:39 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0GHCTtr122280; Wed, 16 Jan 2019 11:12:29 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547658749; bh=9yh5RvztSaWujiBz6b5nKhFLd6k2r4HHS60blovpu98=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=GTP5qre61HuKblMR9JAEyiPZjOZt9NV1BMJ/wQdl8wUXUNVyQwgsvsWQoUMvqt5b5 J44LvlzCiaLd8AxRGmW4QWVJDc4ecu4/xNxWUAAyLOQK4pae8Ei2O00lFevakVn0YY gAvoHwhfS4Z+xV6ifdxECW3dgZTYSeVvdbpkRu90= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0GHCTGU130209 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 Jan 2019 11:12:29 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 16 Jan 2019 11:12:29 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 16 Jan 2019 11:12:29 -0600 Received: from [172.22.93.115] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0GHCS0k029522; Wed, 16 Jan 2019 11:12:28 -0600 Subject: Re: [PATCH 11/14] staging: android: ion: Allow heap name to be null To: Brian Starkey CC: Laura Abbott , Sumit Semwal , Greg Kroah-Hartman , =?UTF-8?Q?Arve_Hj=c3=b8nnev=c3=a5g?= , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , nd References: <20190111180523.27862-1-afd@ti.com> <20190111180523.27862-12-afd@ti.com> <20190116152807.phyq5pqrmbkj6oxk@DESKTOP-E1NTVVP.localdomain> From: "Andrew F. Davis" Message-ID: <39453e0a-2db8-3a59-1909-e02caa9afa31@ti.com> Date: Wed, 16 Jan 2019 11:12:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190116152807.phyq5pqrmbkj6oxk@DESKTOP-E1NTVVP.localdomain> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/16/19 9:28 AM, Brian Starkey wrote: > Hi Andrew, > > On Fri, Jan 11, 2019 at 12:05:20PM -0600, Andrew F. Davis wrote: >> The heap name can be used for debugging but otherwise does not seem >> to be required and no other part of the code will fail if left NULL >> except here. We can make it required and check for it at some point, >> for now lets just prevent this from causing a NULL pointer exception. > > I'm not so keen on this one. In the "new" API with heap querying, the > name string is the only way to identify the heap. I think Laura > mentioned at XDC2017 that it was expected that userspace should use > the strings to find the heap they want. > Right now the names are only for debug. I accidentally left the name null once and got a kernel crash. This is the only spot where it is needed so I fixed it up. The other option is to make the name mandatory and properly error out, I don't want to do that right now until the below discussion is had to see if names really do matter or not. > I'd actually be in favor of making the string a more strict UAPI than > allowing it to be empty (at least, if heap name strings is the API we > decide on for identifying heaps - which is another discussion). > I would think identifying heaps by name would be less portable, but as you said that is a whole different discussion.. Thanks, Andrew > Cheers, > -Brian > >> >> Signed-off-by: Andrew F. Davis >> --- >> drivers/staging/android/ion/ion.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c >> index bba5f682bc25..14e48f6eb734 100644 >> --- a/drivers/staging/android/ion/ion.c >> +++ b/drivers/staging/android/ion/ion.c >> @@ -467,7 +467,7 @@ static int ion_query_heaps(struct ion_heap_query *query) >> max_cnt = query->cnt; >> >> plist_for_each_entry(heap, &dev->heaps, node) { >> - strncpy(hdata.name, heap->name, MAX_HEAP_NAME); >> + strncpy(hdata.name, heap->name ?: "(null)", MAX_HEAP_NAME); >> hdata.name[sizeof(hdata.name) - 1] = '\0'; >> hdata.type = heap->type; >> hdata.heap_id = heap->id; >> -- >> 2.19.1 >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel