From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id BEE526846 for ; Wed, 20 Mar 2013 17:08:07 +0100 (CET) Received: by mail-wg0-f48.google.com with SMTP id 16so1448528wgi.3 for ; Wed, 20 Mar 2013 09:07:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=l+cFlSh3/i+GjsaUQl0DkAagM10ufAaxmAPKVLqMnxg=; b=WBh3HQK06jDMO1fB6/sdu2WvELx6dl488pSTQultvGZbaRnc8xXhgemOXrLc2UrjwJ 8DVt9CvNYjTko2sSrlsefb0Db47BnsmbEeDIBNhSZSM+4CJuaS9o/7KS1CplHnjV06q9 rsqwCnwnm10m5AFlf6v4z4l2eRjjYfHj1R2e4fRbur0tPCDwOLZ429ZLouM9nsSCZEb1 M2PfamKJDUKTjrPNIi7x93+PoiuAlBeCl9NVQDUk4SCd3lYRMapeQmOX8+/w2z9YWpfU ooF8CUhpHF5tsBgLdYwq4GgH7MZ+b3zsZspHrc8QazEPoersXrt65HeQ2JPJkDIQsiOr hG7Q== X-Received: by 10.194.77.81 with SMTP id q17mr11370465wjw.44.1363795625346; Wed, 20 Mar 2013 09:07:05 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPS id ej8sm7689399wib.9.2013.03.20.09.07.02 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 Mar 2013 09:07:04 -0700 (PDT) Received: by 6wind.com (sSMTP sendmail emulation); Wed, 20 Mar 2013 17:07:02 +0100 From: Thomas Monjalon To: dev@dpdk.org Date: Wed, 20 Mar 2013 17:05:03 +0100 Message-Id: X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQmuoIKujNk0TBqfjhL2NnJ8hhMtAVZCuEoyYrzGKoeNGZmshy6Oj8lhJxOyUidYiNsMoiBg Subject: [dpdk-dev] [PATCH 15/22] mem: fix access to huge page with high address X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 16:08:08 -0000 The returned value of lseek is a virtual address which can be different from the offset. Indeed, if the return address has a 64-bit canonical form, the 16 higher bits are all 1 if bit 47 is 1. So the check was wrong. It is better to test against an error value. Acked-by: Damien Millescamps Signed-off-by: Thomas Monjalon --- lib/librte_eal/linuxapp/eal/eal_memory.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index a47dab4..30a955f 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -2,6 +2,7 @@ * BSD LICENSE * * Copyright(c) 2010-2012 Intel Corporation. All rights reserved. + * Copyright(c) 2012-2013 6WIND. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -292,7 +293,7 @@ find_physaddr(struct hugepage *hugepg_tbl, struct hugepage_info *hpi) virt_pfn = (unsigned long)hugepg_tbl[i].orig_va / page_size; offset = sizeof(uint64_t) * virt_pfn; - if (lseek(fd, offset, SEEK_SET) != offset){ + if (lseek(fd, offset, SEEK_SET) == (off_t) -1) { RTE_LOG(ERR, EAL, "%s(): seek error in /proc/self/pagemap: %s", __func__, strerror(errno)); close(fd); -- 1.7.2.5