Changeset 0941e9ae in mainline for kernel/generic/src


Ignore:
Timestamp:
2012-11-05T20:17:17Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
94795812
Parents:
082b7f1
Message:

Test for addition overflow of area's base and size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/as.c

    r082b7f1 r0941e9ae  
    299299        ASSERT((addr % PAGE_SIZE) == 0);
    300300        ASSERT(mutex_locked(&as->lock));
     301        ASSERT(!overflows_add(addr, P2SZ(count)));
    301302       
    302303        /*
     
    513514        if (size == 0)
    514515                return NULL;
    515        
     516
    516517        size_t pages = SIZE2FRAMES(size);
    517518       
     
    531532                }
    532533        }
     534
     535        if (overflows_add(*base, size))
     536                return NULL;
    533537
    534538        if (!check_area_conflicts(as, *base, pages, guarded, NULL)) {
     
    810814                /*
    811815                 * Growing the area.
     816                 */
     817
     818                if (overflows_add(address, P2SZ(pages)))
     819                        return EINVAL;
     820
     821                /*
    812822                 * Check for overlaps with other address space areas.
    813823                 */
Note: See TracChangeset for help on using the changeset viewer.