/*1* Copyright 2010 Tilera Corporation. All Rights Reserved.2*3* This program is free software; you can redistribute it and/or4* modify it under the terms of the GNU General Public License5* as published by the Free Software Foundation, version 2.6*7* This program is distributed in the hope that it will be useful, but8* WITHOUT ANY WARRANTY; without even the implied warranty of9* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or10* NON INFRINGEMENT. See the GNU General Public License for11* more details.12*/1314#include <linux/uaccess.h>15#include <linux/module.h>1617int __range_ok(unsigned long addr, unsigned long size)18{19unsigned long limit = current_thread_info()->addr_limit.seg;20return !((addr < limit && size <= limit - addr) ||21is_arch_mappable_range(addr, size));22}23EXPORT_SYMBOL(__range_ok);2425#ifdef CONFIG_DEBUG_COPY_FROM_USER26void copy_from_user_overflow(void)27{28WARN(1, "Buffer overflow detected!\n");29}30EXPORT_SYMBOL(copy_from_user_overflow);31#endif323334