From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752751AbbBWPpA (ORCPT ); Mon, 23 Feb 2015 10:45:00 -0500 Received: from service87.mimecast.com ([91.220.42.44]:57697 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbbBWPo7 convert rfc822-to-8bit (ORCPT ); Mon, 23 Feb 2015 10:44:59 -0500 Message-ID: <54EB4B02.9070304@arm.com> Date: Mon, 23 Feb 2015 15:45:06 +0000 From: Sudeep Holla User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Mark Rutland CC: Sudeep Holla , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Lorenzo Pieralisi , Greg Kroah-Hartman Subject: Re: [PATCH] drivers/base: cacheinfo: validate device node for all the caches References: <1424095816-4414-1-git-send-email-sudeep.holla@arm.com> <20150223151454.GL9714@leverpostej> In-Reply-To: <20150223151454.GL9714@leverpostej> X-OriginalArrivalTime: 23 Feb 2015 15:44:56.0401 (UTC) FILETIME=[AC4E7C10:01D04F7F] X-MC-Unique: 115022315445701001 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/02/15 15:14, Mark Rutland wrote: > On Mon, Feb 16, 2015 at 02:10:16PM +0000, Sudeep Holla wrote: >> On architectures that depend on DT for obtaining cache hierarcy, we need >> to validate the device node for all the cache indices, failing to do so >> might result in wrong information being exposed to the userspace. >> >> This is quite possible on initial/incomplete versions of the device >> trees. In such cases, it's better to bail out if all the required device >> nodes are not present. >> >> This patch adds checks for the validation of device node for all the >> caches and doesn't initialise the cacheinfo if there's any error. >> >> Cc: Greg Kroah-Hartman >> Reported-by: Mark Rutland >> Signed-off-by: Sudeep Holla >> --- >> drivers/base/cacheinfo.c | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c >> index 6e64563361f0..7015bf05c828 100644 >> --- a/drivers/base/cacheinfo.c >> +++ b/drivers/base/cacheinfo.c [...] >> @@ -189,8 +195,10 @@ static int detect_cache_attributes(unsigned int cpu) >> * will be set up here only if they are not populated already >> */ >> ret = cache_shared_cpu_map_setup(cpu); >> - if (ret) >> + if (ret) { >> + pr_err("failed to setup cache hierarcy from DT\n"); > > It would probably be better if this were something like: > > pr_warn("Unable to detect cache hierarcy from DT for CPU %d\n", > cpu); > Agreed, will update and send v2. > Otherwise, this looks sane to me, and it would be nice to have this in > ASAP so as to avoid exposing erroneous information to userspace. So: > > Acked-by: Mark Rutland > Thanks. Regards, Sudeep