diff options
author | dim <dim@FreeBSD.org> | 2010-08-31 18:11:50 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2010-08-31 18:11:50 +0000 |
commit | 642b72c1ba89d2df7d6e91c439cf81c68cfc00d4 (patch) | |
tree | 21d277c9f6ccc9222d794a4bf8fd6199437674d0 /sys/boot/pc98 | |
parent | 9690cad4e39c8559605213c37833bd2dd2d2a77a (diff) | |
download | FreeBSD-src-642b72c1ba89d2df7d6e91c439cf81c68cfc00d4.zip FreeBSD-src-642b72c1ba89d2df7d6e91c439cf81c68cfc00d4.tar.gz |
Avoid directly manipulating a NULL pointer (which could result in
undefined behaviour) in sys/boot/pc98/boot2/boot2.c.
Reviewed by: nyan
Approved by: rpaulo (mentor)
Diffstat (limited to 'sys/boot/pc98')
-rw-r--r-- | sys/boot/pc98/boot2/boot2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/boot/pc98/boot2/boot2.c b/sys/boot/pc98/boot2/boot2.c index 8c833ba..e35b425 100644 --- a/sys/boot/pc98/boot2/boot2.c +++ b/sys/boot/pc98/boot2/boot2.c @@ -187,9 +187,9 @@ xfsread(ino_t inode, void *buf, size_t nbyte) static inline uint32_t memsize(void) { - u_char *p = (u_char *)PTOV(0); + u_char *p = (u_char *)PTOV(0x401); - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; } static inline void |