summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2009-04-03 22:42:31 +0000
committerJeff Johnston <jjohnstn@redhat.com>2009-04-03 22:42:31 +0000
commit0463fc624cb42dd2b766ea02b65a62abbf0a59ad (patch)
tree0df87702fc3666da0addaf77f2166de27e47776e
parentd65c75640ecb816238ab9fe4fd830b5e142eecb7 (diff)
downloadcygnal-0463fc624cb42dd2b766ea02b65a62abbf0a59ad.tar.gz
cygnal-0463fc624cb42dd2b766ea02b65a62abbf0a59ad.tar.bz2
cygnal-0463fc624cb42dd2b766ea02b65a62abbf0a59ad.zip
2009-04-03 Ken Werner <ken.werner@de.ibm.com>
* libc/machine/spu/mmap_ea.c (mmap_ea): Check length argument.
-rw-r--r--newlib/ChangeLog4
-rw-r--r--newlib/libc/machine/spu/mmap_ea.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 32b415a46..eec006e96 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,5 +1,9 @@
2009-04-03 Ken Werner <ken.werner@de.ibm.com>
+ * libc/machine/spu/mmap_ea.c (mmap_ea): Check length argument.
+
+2009-04-03 Ken Werner <ken.werner@de.ibm.com>
+
* libc/machine/spu/sys/linux_syscalls.h: include <sys/types.h>
(linux_getpid, linux_gettid): Declare.
diff --git a/newlib/libc/machine/spu/mmap_ea.c b/newlib/libc/machine/spu/mmap_ea.c
index 4097fc007..0b4a5d8b4 100644
--- a/newlib/libc/machine/spu/mmap_ea.c
+++ b/newlib/libc/machine/spu/mmap_ea.c
@@ -41,8 +41,13 @@ __ea void *mmap_ea (__ea void *start, size_ea_t length, int prot, int
flags, int fd, off_t offset)
{
#ifdef __EA64__
- return (__ea void *) mmap_eaddr ((unsigned long long) start, length,
- prot, flags, fd, offset);
+ if (length > 0xffffffffULL) {
+ errno = ENOMEM;
+ return MAP_FAILED_EADDR;
+ } else {
+ return (__ea void *) mmap_eaddr ((unsigned long long) start,
+ (size_t) length, prot, flags, fd, offset);
+ }
#else /* __EA32__ */
unsigned long long res;
/*