subr_bus.c (af00898b5d7bac6734c407c1d2f4362a08fe4532) | subr_bus.c (51871224c09b8f700c65c6aab9f060959bb85971) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 1997,1998,2003 Doug Rabson 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 1672 unchanged lines hidden (view full) --- 1681 * extend the table to make room for all units up to and including 1682 * this one. 1683 */ 1684 if (unit >= dc->maxunit) { 1685 device_t *newlist, *oldlist; 1686 int newsize; 1687 1688 oldlist = dc->devices; | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 1997,1998,2003 Doug Rabson 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 1672 unchanged lines hidden (view full) --- 1681 * extend the table to make room for all units up to and including 1682 * this one. 1683 */ 1684 if (unit >= dc->maxunit) { 1685 device_t *newlist, *oldlist; 1686 int newsize; 1687 1688 oldlist = dc->devices; |
1689 newsize = roundup((unit + 1), MINALLOCSIZE / sizeof(device_t)); | 1689 newsize = roundup((unit + 1), 1690 MAX(1, MINALLOCSIZE / sizeof(device_t))); |
1690 newlist = malloc(sizeof(device_t) * newsize, M_BUS, M_NOWAIT); 1691 if (!newlist) 1692 return (ENOMEM); 1693 if (oldlist != NULL) 1694 bcopy(oldlist, newlist, sizeof(device_t) * dc->maxunit); 1695 bzero(newlist + dc->maxunit, 1696 sizeof(device_t) * (newsize - dc->maxunit)); 1697 dc->devices = newlist; --- 4324 unchanged lines hidden --- | 1691 newlist = malloc(sizeof(device_t) * newsize, M_BUS, M_NOWAIT); 1692 if (!newlist) 1693 return (ENOMEM); 1694 if (oldlist != NULL) 1695 bcopy(oldlist, newlist, sizeof(device_t) * dc->maxunit); 1696 bzero(newlist + dc->maxunit, 1697 sizeof(device_t) * (newsize - dc->maxunit)); 1698 dc->devices = newlist; --- 4324 unchanged lines hidden --- |