This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/6] Use INLINE_SYSCALL_ERROR_RETURN
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 13 Oct 2015 06:43:22 -0700
- Subject: Re: [PATCH 2/6] Use INLINE_SYSCALL_ERROR_RETURN
- Authentication-results: sourceware.org; auth=none
- References: <20151012231944 dot GA27441 at intel dot com> <561D0388 dot 8030206 at redhat dot com>
On Tue, Oct 13, 2015 at 6:13 AM, Florian Weimer <fweimer@redhat.com> 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.
--
H.J.
----
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));
return raddr;
}