Page MenuHomeFreeBSD

D37566.id113674.diff
No OneTemporary

D37566.id113674.diff

diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2610,8 +2610,7 @@
else if (ifr_buffer_get_length(ifr) == 0)
descrbuf = NULL;
else {
- descrbuf = malloc(ifr_buffer_get_length(ifr),
- M_IFDESCR, M_WAITOK | M_ZERO);
+ descrbuf = if_allocdescr(ifr_buffer_get_length(ifr), true);
error = copyin(ifr_buffer_get_buffer(ifr), descrbuf,
ifr_buffer_get_length(ifr) - 1);
if (error) {
@@ -4273,6 +4272,12 @@
if_freedescr(odescrbuf);
}
+char *
+if_allocdescr(size_t sz, bool waitok)
+{
+ return (malloc(sz, M_IFDESCR, M_ZERO | (waitok ? M_ZERO : 0)));
+}
+
void
if_freedescr(char *descrbuf)
{
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -740,6 +740,7 @@
int if_getcapenable(if_t ifp);
const char *if_getdname(if_t ifp);
void if_setdescr(if_t ifp, char *descrbuf);
+char *if_allocdescr(size_t sz, bool waitok);
void if_freedescr(char *descrbuf);
int if_setdev(if_t ifp, void *dev);
int if_setdrvflagbits(if_t ifp, int if_setflags, int clear_flags);

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 15, 10:38 AM (14 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15408540
Default Alt Text
D37566.id113674.diff (1 KB)

Event Timeline