From patchwork Tue Oct 13 13:43:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 529740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B3C4F1402A8 for ; Wed, 14 Oct 2015 00:43:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=OUABzJxm; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; q=dns; s=default; b= LLP6Ld9Rp5zZiRltOizHpNRdA5J84FJeTI/r/mAN7yunoM6AVcf1yCqBq/driIlq R1qIdZENLPj9PKafZo9BqolRSrqYRG1Qe2M3EzI3ieutIMM4XOB/phZUtz4kfoeL 4vXDbtE41KheNJDB427Nj69mPdKndzps6SgEW7AShrk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; s=default; bh=i19bn 4njRxfQkJEqaqnCSiOmvCo=; b=OUABzJxmDWzbqOIxCQmO4OG1VWgH2ETbxyR67 dyI6BRAUlFx9gjJ1EavuVkDt5oHyKVclWEqkiDLFMPDPMGcKkWgWd+oD69r4zYNu UaBJQCbbJFdR62DdwiA2LB048sUN3IxLVJEaaJj84rvTXG45rGDVtdyyooZe8yyv 4HcuRg= Received: (qmail 75647 invoked by alias); 13 Oct 2015 13:43:28 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 75637 invoked by uid 89); 13 Oct 2015 13:43:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f173.google.com MIME-Version: 1.0 X-Received: by 10.60.36.202 with SMTP id s10mr20233371oej.0.1444743802280; Tue, 13 Oct 2015 06:43:22 -0700 (PDT) In-Reply-To: <561D0388.8030206@redhat.com> References: <20151012231944.GA27441@intel.com> <561D0388.8030206@redhat.com> Date: Tue, 13 Oct 2015 06:43:22 -0700 Message-ID: Subject: Re: [PATCH 2/6] Use INLINE_SYSCALL_ERROR_RETURN From: "H.J. Lu" To: Florian Weimer Cc: GNU C Library On Tue, Oct 13, 2015 at 6:13 AM, Florian Weimer wrote: > On 10/13/2015 01:19 AM, H.J. Lu wrote: >> diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c >> index 94d18d3..3f6388b 100644 >> --- a/sysdeps/unix/sysv/linux/shmat.c >> +++ b/sysdeps/unix/sysv/linux/shmat.c >> @@ -43,10 +43,8 @@ shmat (shmid, shmaddr, shmflg) >> (long int) &raddr, >> (void *) shmaddr); >> if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) >> - { >> - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); >> - return (void *) -1l; >> - } >> + return (void *) INLINE_SYSCALL_ERROR_RETURN (INTERNAL_SYSCALL_ERRNO (resultvar, >> + err)); > > Please put in a cast to ptrdiff_t before the cast to void *. This makes > it more likely that we get the desired sign extension. Or use MAP_FAILED. I am making this change. diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c index 1c9d3c1..8d5b0a4 100644 --- a/sysdeps/unix/sysv/linux/mmap64.c +++ b/sysdeps/unix/sysv/linux/mmap64.c @@ -46,7 +46,7 @@ __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) } #endif if (offset & ((1 << page_shift) - 1)) - return (void *) INLINE_SYSCALL_ERROR_RETURN (EINVAL); + return (void *) (ptrdiff_t) INLINE_SYSCALL_ERROR_RETURN (EINVAL); void *result; result = (void *) INLINE_SYSCALL (mmap2, 6, addr, diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c index 3f6388b..15f269a 100644 --- a/sysdeps/unix/sysv/linux/shmat.c +++ b/sysdeps/unix/sysv/linux/shmat.c @@ -43,8 +43,7 @@ shmat (shmid, shmaddr, shmflg) (long int) &raddr, (void *) shmaddr); if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) - return (void *) INLINE_SYSCALL_ERROR_RETURN (INTERNAL_SYSCALL_ERRNO (resultvar, - err)); + return (void *) (ptrdiff_t) INLINE_SYSCALL_ERROR_RETURN (INTERNAL_SYSCALL_ERRNO (resultvar, err));