summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Knudsen <mk@cvs.openbsd.org>2010-03-03 23:26:57 +0000
committerMichael Knudsen <mk@cvs.openbsd.org>2010-03-03 23:26:57 +0000
commit36010b03ca6c41034c73f970152b776a99893d73 (patch)
tree9ca0aeffd755eb3ca82739c1dca9600a47169201
parent76817c016d7148ea42731e894a50ef5ea9d69152 (diff)
In urndis_ctrl_recv(), don't copy the received data to a newly allocated
buffer of the exact response when we can just pass on the buffer. It's going to be released right away anyway.
-rw-r--r--sys/dev/usb/if_urndis.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c
index 07310b954ac..bd595281037 100644
--- a/sys/dev/usb/if_urndis.c
+++ b/sys/dev/usb/if_urndis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_urndis.c,v 1.5 2010/03/03 19:01:03 mk Exp $ */
+/* $OpenBSD: if_urndis.c,v 1.6 2010/03/03 23:26:56 mk Exp $ */
/*
* Copyright (c) 2010 Jonathan Armani <dbd@asystant.net>
@@ -162,8 +162,8 @@ urndis_ctrl_send(struct urndis_softc *sc, void *buf, size_t len)
struct urndis_comp_hdr *
urndis_ctrl_recv(struct urndis_softc *sc)
{
-#define RNDIS_RESPONSE_LEN 0x400 /* XXX seriously? */
- struct urndis_comp_hdr *hdr, *pkt;
+#define RNDIS_RESPONSE_LEN 0x400
+ struct urndis_comp_hdr *hdr;
char *buf;
usbd_status err;
@@ -197,22 +197,7 @@ urndis_ctrl_recv(struct urndis_softc *sc)
return NULL;
}
- if (letoh32(hdr->rm_len) < 128) {
- pkt = malloc(letoh32(hdr->rm_len),
- M_TEMP, M_WAITOK | M_CANFAIL);
- if (pkt == NULL) {
- printf("%s: out of memory\n", DEVNAME(sc));
- /* XXX just use buf? */
- free(buf, M_TEMP);
- } else {
- memcpy(pkt, hdr, letoh32(hdr->rm_len));
- free(buf, M_TEMP);
- }
- } else {
- pkt = hdr;
- }
-
- return pkt;
+ return hdr;
}
u_int32_t