[rtems commit] libcsupport: Avoid division by zero
Sebastian Huber
sebh at rtems.org
Fri May 10 10:05:35 UTC 2013
Module: rtems
Branch: master
Commit: b71336c6e558f8e498d2bb6199112645bb32b955
Changeset: http://git.rtems.org/rtems/commit/?id=b71336c6e558f8e498d2bb6199112645bb32b955
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri May 10 11:59:12 2013 +0200
libcsupport: Avoid division by zero
---
.../libcsupport/src/rtems_heap_extend_via_sbrk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c b/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c
index d27a366..f4f1274 100644
--- a/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c
+++ b/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c
@@ -38,7 +38,7 @@ void *rtems_heap_extend_via_sbrk(
{
ptrdiff_t sbrk_amount = RTEMS_Malloc_Sbrk_amount;
ptrdiff_t sbrk_size = (ptrdiff_t) alloc_size;
- ptrdiff_t misaligned = sbrk_size % sbrk_amount;
+ ptrdiff_t misaligned = sbrk_amount != 0 ? sbrk_size % sbrk_amount : 0;
void *return_this = NULL;
if ( misaligned != 0 ) {
More information about the vc
mailing list