Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751350AbbKKF2J (ORCPT ); Wed, 11 Nov 2015 00:28:09 -0500 Received: from mga01.intel.com ([192.55.52.88]:4058 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbbKKF2G convert rfc822-to-8bit (ORCPT ); Wed, 11 Nov 2015 00:28:06 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,274,1444719600"; d="scan'208";a="847631747" From: "Chen, Yu C" To: "Zheng, Lv" CC: Lv Zheng , "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "Wysocki, Rafael J" , "Brown, Len" Subject: RE: [PATCH v2 5/7] ACPI / x86: introduce acpi_os_readable() support Thread-Topic: [PATCH v2 5/7] ACPI / x86: introduce acpi_os_readable() support Thread-Index: AQHRG5DvOI4Q/C8PFUC4WTh3lRAEKp6U80WggAFM3nCAAAqqcA== Date: Wed, 11 Nov 2015 05:27:32 +0000 Message-ID: <36DF59CE26D8EE47B0655C516E9CE64028672B74@shsmsx102.ccr.corp.intel.com> References: <36DF59CE26D8EE47B0655C516E9CE6402867258C@shsmsx102.ccr.corp.intel.com> <1AE640813FDE7649BE1B193DEA596E883BADD796@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <1AE640813FDE7649BE1B193DEA596E883BADD796@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2519 Lines: 75 Hi, > -----Original Message----- > From: Zheng, Lv > Sent: Wednesday, November 11, 2015 1:07 PM > To: Chen, Yu C > Cc: Lv Zheng; linux-kernel@vger.kernel.org; linux-acpi@vger.kernel.org; > Wysocki, Rafael J; Brown, Len > Subject: RE: [PATCH v2 5/7] ACPI / x86: introduce acpi_os_readable() support > > Hi, Yu > > > From: Chen, Yu C > > Sent: Tuesday, November 10, 2015 5:43 PM > > > > Hi, Lv > > Sorry for my late feedback on the patch, one minor nit below: > > > > > From: Zheng, Lv > > > Sent: Tuesday, November 10, 2015 4:22 PM > > > > > > From: Chen Yu > > > > > > This patch implements acpi_os_readable(). The function is used by > > > ACPI AML debugger to validate user specified pointers for the > > > dumpable AML operand objects. > > > > > > Signed-off-by: Chen Yu > > > Signed-off-by: Lv Zheng > > > --- > > > +bool __acpi_memory_readable(void *pointer, size_t length) { > > > + unsigned long start_pfn, end_pfn; > > > + > > We should only check the low memory, otherwise the highmem address > > might bring unexpected behavior in this function, I think we should add: > > if (pointer >= PAGE_OFFSET) > > return false; > > I think pfn_range_is_mapped() can ensure this. virt_to_page might return an invalid page struct if pointer is not a valid kernel address. > If you want to add some sanity checks, IMO, virt_addr_valid() could be > better. Yes, virt_addr_valid is better. > > > > + start_pfn = page_to_pfn(virt_to_page(pointer)); > > > + end_pfn = page_to_pfn(virt_to_page(pointer + length)); > > Convert pointer to char* first? > > end_pfn = page_to_pfn(virt_to_page((char*)pointer + length)); > > Either a compiler supports such a conversion or a compiler ends up fatal error > by complaining unknown sizeof(void *). > So there is no need to do this here as the build test has passed. > OK, got it, thanks. > Thanks and best regards > -Lv > > > > > > + /* > > > + * Since the acpi address is allocated by kmalloc, we only > > > + * need to consider the direct-mapping virtual address, > > > + * rather than the kmap/vmalloc/ioremap address. > > > + */ > > > + return pfn_range_is_mapped(start_pfn, end_pfn) ? true : false; } > > > + > > Thanks! > > > > Best Regards, > > Yu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/