From patchwork Fri Nov 15 15:27:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 21541 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3047623FBA for ; Fri, 15 Nov 2013 15:28:01 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id i17sf6290020qcy.10 for ; Fri, 15 Nov 2013 07:28:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=+3nr3BmUNq8cSoayNw0Bt2b03jyb0CTcBOg0Kq8jr8E=; b=ETQie8SEEAk/pmhpa9xWtRCR/wfrJWagopgZn45kFsJCE+vvRVYefg3s6kBZlfulS1 fGDOp2LXBbHqwHwwyVEP2KFZu2iBrqXyRiFHqcomyd6e9LmszMSzc2ApG6L1wkZ+I2Ov T9Sl4KpLaOhkN3mag63+2bhued0xhFIbnvfv1YkGaiFjwPl0t22QPVQ5fzD+RGAG0O/A 0aOes+Fq8scCSSC3g/Roe84jBYNHZydI7pmUpTj52tjI8t36sNoVJq1P8dmdRFzuNbfT zz9ho5yj8VbIYIbwwylGeuNaTlxHUx/dQNNVz/JS1mZs2YvJNLhqQnNR+tKssz2Q92JL 7bOA== X-Gm-Message-State: ALoCoQnRbXviURrQNCo0E1kBP1SayHnc6PDdN1LR5WK2yJEbURWWbL8eiKES5n0g3ofL8XYDYm66 X-Received: by 10.236.4.69 with SMTP id 45mr4226533yhi.20.1384529280429; Fri, 15 Nov 2013 07:28:00 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.196 with SMTP id de4ls1527308qeb.77.gmail; Fri, 15 Nov 2013 07:28:00 -0800 (PST) X-Received: by 10.52.106.201 with SMTP id gw9mr117632vdb.49.1384529280285; Fri, 15 Nov 2013 07:28:00 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id mh9si1762406vec.26.2013.11.15.07.28.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Nov 2013 07:28:00 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hv10so1847551vcb.15 for ; Fri, 15 Nov 2013 07:28:00 -0800 (PST) X-Received: by 10.58.136.231 with SMTP id qd7mr4884542veb.1.1384529280174; Fri, 15 Nov 2013 07:28:00 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp36958vcz; Fri, 15 Nov 2013 07:27:59 -0800 (PST) X-Received: by 10.194.60.73 with SMTP id f9mr563050wjr.65.1384529279287; Fri, 15 Nov 2013 07:27:59 -0800 (PST) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx.google.com with ESMTPS id wn5si1438804wjb.95.2013.11.15.07.27.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Nov 2013 07:27:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.182 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.212.182; Received: by mail-wi0-f182.google.com with SMTP id i19so1144627wiw.15 for ; Fri, 15 Nov 2013 07:27:58 -0800 (PST) X-Received: by 10.180.211.71 with SMTP id na7mr7845266wic.5.1384529278342; Fri, 15 Nov 2013 07:27:58 -0800 (PST) Received: from localhost.localdomain ([80.215.132.217]) by mx.google.com with ESMTPSA id uc12sm6079087wib.3.2013.11.15.07.27.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Nov 2013 07:27:57 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: ian.campbell@citrix.com, tim@xen.org, patches@linaro.org, stefano.stabellini@eu.citrix.com, Julien Grall Subject: [PATCH] xen/arm: ioremap_attr: return NULL is __vmap failed Date: Fri, 15 Nov 2013 15:27:35 +0000 Message-Id: <1384529257-7590-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Most of ioremap_* caller check if ioremap returns NULL. Actually, if the physical address is non-aligned, Xen will return the pointer given by __vmap plus the offset in the page. So if ioremap_* fails, the caller will retrieve an non-NULL address and continue as if there was no error. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- xen/arch/arm/mm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 26c6768..5137668 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -742,8 +742,13 @@ void *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes) unsigned long pfn = PFN_DOWN(pa); unsigned int offs = pa & (PAGE_SIZE - 1); unsigned int nr = PFN_UP(offs + len); + void *ptr; - return (__vmap(&pfn, nr, 1, 1, attributes) + offs); + ptr = __vmap(&pfn, nr, 1, 1, attributes); + if ( ptr == NULL ) + return NULL; + + return (ptr + offs); } void *ioremap(paddr_t pa, size_t len)