From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752847AbZBNGRx (ORCPT ); Sat, 14 Feb 2009 01:17:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751455AbZBNGRj (ORCPT ); Sat, 14 Feb 2009 01:17:39 -0500 Received: from terminus.zytor.com ([198.137.202.10]:52228 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbZBNGRj (ORCPT ); Sat, 14 Feb 2009 01:17:39 -0500 Message-ID: <499661E9.3070809@zytor.com> Date: Fri, 13 Feb 2009 22:17:13 -0800 From: "H. Peter Anvin" User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: "Eric W. Biederman" CC: Ingo Molnar , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] i386 pci: Handle mmaping 64bit bars. References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric W. Biederman wrote: > While reading through pci_mmap_page_range I realized that if don't > properly handle 64bit bars in the 32bit kernel. > > Without the added cast the shift will be done in 32bit despite being > assigned to a 64bit variable and if we are mmaping an address above > 4G things will do the wrong thing. Hm... this really should be resource_size_t, no? > - u64 addr = vma->vm_pgoff << PAGE_SHIFT; > + u64 addr = ((u64)vma->vm_pgoff) << PAGE_SHIFT; -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.