if_clone.c (279538) | if_clone.c (298995) |
---|---|
1/*- 2 * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> 3 * Copyright (c) 1980, 1986, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)if.c 8.5 (Berkeley) 1/9/95 | 1/*- 2 * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> 3 * Copyright (c) 1980, 1986, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)if.c 8.5 (Berkeley) 1/9/95 |
31 * $FreeBSD: head/sys/net/if_clone.c 279538 2015-03-02 20:00:03Z hrs $ | 31 * $FreeBSD: head/sys/net/if_clone.c 298995 2016-05-03 18:05:43Z pfg $ |
32 */ 33 34#include <sys/param.h> 35#include <sys/eventhandler.h> 36#include <sys/malloc.h> 37#include <sys/limits.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> --- 439 unchanged lines hidden (view full) --- 479 480 IF_CLONERS_LOCK(); 481 /* 482 * Set our internal output buffer size. We could end up not 483 * reporting a cloner that is added between the unlock and lock 484 * below, but that's not a major problem. Not caping our 485 * allocation to the number of cloners actually in the system 486 * could be because that would let arbitrary users cause us to | 32 */ 33 34#include <sys/param.h> 35#include <sys/eventhandler.h> 36#include <sys/malloc.h> 37#include <sys/limits.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> --- 439 unchanged lines hidden (view full) --- 479 480 IF_CLONERS_LOCK(); 481 /* 482 * Set our internal output buffer size. We could end up not 483 * reporting a cloner that is added between the unlock and lock 484 * below, but that's not a major problem. Not caping our 485 * allocation to the number of cloners actually in the system 486 * could be because that would let arbitrary users cause us to |
487 * allocate abritrary amounts of kernel memory. | 487 * allocate arbitrary amounts of kernel memory. |
488 */ 489 buf_count = (V_if_cloners_count < ifcr->ifcr_count) ? 490 V_if_cloners_count : ifcr->ifcr_count; 491 IF_CLONERS_UNLOCK(); 492 493 outbuf = malloc(IFNAMSIZ*buf_count, M_CLONE, M_WAITOK | M_ZERO); 494 495 IF_CLONERS_LOCK(); --- 229 unchanged lines hidden --- | 488 */ 489 buf_count = (V_if_cloners_count < ifcr->ifcr_count) ? 490 V_if_cloners_count : ifcr->ifcr_count; 491 IF_CLONERS_UNLOCK(); 492 493 outbuf = malloc(IFNAMSIZ*buf_count, M_CLONE, M_WAITOK | M_ZERO); 494 495 IF_CLONERS_LOCK(); --- 229 unchanged lines hidden --- |