diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-08-01 05:36:50 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-08-01 05:36:50 +0000 |
commit | 2e4c19f779ce48faaf5abcaa186def74956a6981 (patch) | |
tree | 2a7d441b21de326c5a27b994bce0b47dcb3dd0e7 /sys/dev | |
parent | 0fd85d9caed3489931a1fa9c2b7520960293653d (diff) |
Don't keep the devinfo string on the stack, instead use malloc/free.
This should cure some rare stack overflows.
From augustss NetBSD
ok dlg@ pascoe@
Diffstat (limited to 'sys/dev')
35 files changed, 205 insertions, 147 deletions
diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index fedaa908087..b58b77115f7 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.63 2005/07/07 22:47:08 dlg Exp $ */ +/* $OpenBSD: if_atu.c,v 1.64 2005/08/01 05:36:47 brad Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -1240,7 +1240,7 @@ atu_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) USB_ATTACH(atu) { USB_ATTACH_START(atu, sc, uaa); - char devinfo[1024]; + char *devinfop; usbd_status err; usbd_device_handle dev = uaa->device; u_int8_t mode, channel; @@ -1248,9 +1248,10 @@ USB_ATTACH(atu) sc->sc_state = ATU_S_UNCONFIG; - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s", USBDEVNAME(sc->atu_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->atu_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, ATU_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 1b89995f06d..32a24dcd98d 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aue.c,v 1.41 2005/07/02 22:21:12 brad Exp $ */ +/* $OpenBSD: if_aue.c,v 1.42 2005/08/01 05:36:47 brad Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -725,7 +725,7 @@ USB_MATCH(aue) USB_ATTACH(aue) { USB_ATTACH_START(aue, sc, uaa); - char devinfo[1024]; + char *devinfop; int s; u_char eaddr[ETHER_ADDR_LEN]; struct ifnet *ifp; @@ -739,9 +739,10 @@ USB_ATTACH(aue) DPRINTFN(5,(" : aue_attach: sc=%p", sc)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->aue_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->aue_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, AUE_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 562d5486c99..86a9158f0e1 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axe.c,v 1.28 2005/07/18 07:38:43 jsg Exp $ */ +/* $OpenBSD: if_axe.c,v 1.29 2005/08/01 05:36:48 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 @@ -451,12 +451,12 @@ USB_ATTACH(axe) usb_endpoint_descriptor_t *ed; struct mii_data *mii; u_char eaddr[ETHER_ADDR_LEN]; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->axe_dev); struct ifnet *ifp; int i, s; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; sc->axe_unit = self->dv_unit; /*device_get_unit(self);*/ @@ -485,7 +485,8 @@ USB_ATTACH(axe) id = usbd_get_interface_descriptor(sc->axe_iface); - printf("%s: %s", USBDEVNAME(sc->axe_dev), devinfo); + printf("%s: %s", USBDEVNAME(sc->axe_dev), devinfop); + usbd_devinfo_free(devinfop); /* Find endpoints. */ for (i = 0; i < id->bNumEndpoints; i++) { diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index d52eefec67c..9e64e219839 100644 --- a/sys/dev/usb/if_cdce.c +++ b/sys/dev/usb/if_cdce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdce.c,v 1.9 2005/07/02 22:21:12 brad Exp $ */ +/* $OpenBSD: if_cdce.c,v 1.10 2005/08/01 05:36:48 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -126,7 +126,7 @@ USB_MATCH(cdce) USB_ATTACH(cdce) { USB_ATTACH_START(cdce, sc, uaa); - char devinfo[1024]; + char *devinfop; int s; struct ifnet *ifp; usbd_device_handle dev = uaa->device; @@ -138,9 +138,10 @@ USB_ATTACH(cdce) u_int16_t macaddr_hi; int i; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->cdce_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->cdce_dev), devinfop); + usbd_devinfo_free(devinfop); sc->cdce_udev = uaa->device; sc->cdce_ctl_iface = uaa->iface; diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index cf0569e4c45..0da05862cb0 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cue.c,v 1.26 2005/07/02 22:21:12 brad Exp $ */ +/* $OpenBSD: if_cue.c,v 1.27 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -462,7 +462,7 @@ USB_MATCH(cue) USB_ATTACH(cue) { USB_ATTACH_START(cue, sc, uaa); - char devinfo[1024]; + char *devinfop; int s; u_char eaddr[ETHER_ADDR_LEN]; usbd_device_handle dev = uaa->device; @@ -475,9 +475,10 @@ USB_ATTACH(cue) DPRINTFN(5,(" : cue_attach: sc=%p, dev=%p", sc, dev)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->cue_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->cue_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, CUE_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 435dfa371fe..fe28ccc43e7 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_kue.c,v 1.37 2005/07/02 22:21:12 brad Exp $ */ +/* $OpenBSD: if_kue.c,v 1.38 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -540,15 +540,16 @@ kue_attachhook(void *xsc) USB_ATTACH(kue) { USB_ATTACH_START(kue, sc, uaa); - char devinfo[1024]; + char *devinfop; usbd_device_handle dev = uaa->device; usbd_status err; DPRINTFN(5,(" : kue_attach: sc=%p, dev=%p", sc, dev)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->kue_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->kue_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, KUE_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index cbaa5953a65..903df1e3ca0 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.39 2005/07/18 14:41:15 jsg Exp $ */ +/* $OpenBSD: if_ral.c,v 1.40 2005/08/01 05:36:48 brad Exp $ */ /*- * Copyright (c) 2005 @@ -357,14 +357,15 @@ USB_ATTACH(ural) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; usbd_status error; - char devinfo[1024]; + char *devinfop; int i; sc->sc_udev = uaa->device; - usbd_devinfo(sc->sc_udev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); if (usbd_set_config_no(sc->sc_udev, RAL_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", diff --git a/sys/dev/usb/if_ubt.c b/sys/dev/usb/if_ubt.c index e50fb42ccdc..50e2e0580e2 100644 --- a/sys/dev/usb/if_ubt.c +++ b/sys/dev/usb/if_ubt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ubt.c,v 1.2 2005/06/24 20:06:11 martin Exp $ */ +/* $OpenBSD: if_ubt.c,v 1.3 2005/08/01 05:36:48 brad Exp $ */ /* * ng_ubt.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ubt.c,v 1.2 2005/06/24 20:06:11 martin Exp $ + * $Id: if_ubt.c,v 1.3 2005/08/01 05:36:48 brad Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c,v 1.20 2004/10/12 23:33:46 emax Exp $ */ @@ -153,7 +153,7 @@ USB_ATTACH(ubt) usb_config_descriptor_t *cd = NULL; usb_interface_descriptor_t *id = NULL; usb_endpoint_descriptor_t *ed = NULL; - char devinfo[1024]; + char *devinfop; usbd_status error; int i, ai, alt_no, isoc_in, isoc_out, isoc_isize, isoc_osize; @@ -161,9 +161,11 @@ USB_ATTACH(ubt) /* Get USB device info */ sc->sc_udev = uaa->device; - usbd_devinfo(sc->sc_udev, 0, devinfo, sizeof(devinfo)); + + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); /* * Initialize device softc structure diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index ce4cd039d8d..73f851a0ac0 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_udav.c,v 1.12 2005/07/02 22:21:12 brad Exp $ */ +/* $OpenBSD: if_udav.c,v 1.13 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* @@ -182,16 +182,17 @@ USB_ATTACH(udav) usbd_status err; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); struct ifnet *ifp; struct mii_data *mii; u_char eaddr[ETHER_ADDR_LEN]; int i, s; - usbd_devinfo(dev, 0, devinfo, sizeof(devinfo)); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s", devname, devinfo); + printf("%s: %s", devname, devinfop); + usbd_devinfo_free(devinfop); /* Move the device into the configured state. */ err = usbd_set_config_no(dev, UDAV_CONFIG_NO, 1); diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index 6f12cb938cc..eb46d766b1e 100644 --- a/sys/dev/usb/if_upl.c +++ b/sys/dev/usb/if_upl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upl.c,v 1.19 2005/07/02 22:21:12 brad Exp $ */ +/* $OpenBSD: if_upl.c,v 1.20 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -241,7 +241,7 @@ USB_MATCH(upl) USB_ATTACH(upl) { USB_ATTACH_START(upl, sc, uaa); - char devinfo[1024]; + char *devinfop; int s; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; @@ -253,9 +253,10 @@ USB_ATTACH(upl) DPRINTFN(5,(" : upl_attach: sc=%p, dev=%p", sc, dev)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, UPL_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index bc419abf913..e3337d094ef 100644 --- a/sys/dev/usb/if_url.c +++ b/sys/dev/usb/if_url.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_url.c,v 1.25 2005/07/19 11:42:37 jsg Exp $ */ +/* $OpenBSD: if_url.c,v 1.26 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */ /* * Copyright (c) 2001, 2002 @@ -206,16 +206,17 @@ USB_ATTACH(url) usbd_status err; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); struct ifnet *ifp; struct mii_data *mii; u_char eaddr[ETHER_ADDR_LEN]; int i, s; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); /* Move the device into the configured state. */ err = usbd_set_config_no(dev, URL_CONFIG_NO, 1); diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c index 3183e548ba6..7530af86dec 100644 --- a/sys/dev/usb/if_wi_usb.c +++ b/sys/dev/usb/if_wi_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_usb.c,v 1.18 2005/02/18 06:47:03 jsg Exp $ */ +/* $OpenBSD: if_wi_usb.c,v 1.19 2005/08/01 05:36:48 brad Exp $ */ /* * Copyright (c) 2003 Dale Rahn. All rights reserved. @@ -281,7 +281,7 @@ USB_MATCH(wi_usb) USB_ATTACH(wi_usb) { USB_ATTACH_START(wi_usb, sc, uaa); - char devinfo[1024]; + char *devinfop; /* int s; */ usbd_device_handle dev = uaa->device; usbd_interface_handle iface; @@ -299,9 +299,10 @@ USB_ATTACH(wi_usb) USB_ATTACH_ERROR_RETURN; } - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->wi_usb_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->wi_usb_dev), devinfop); + usbd_devinfo_free(devinfop); /* XXX - any tasks? */ diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index e2837ea2544..15bc4a7a5c7 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.21 2004/10/18 11:26:52 deraadt Exp $ */ +/* $OpenBSD: uaudio.c,v 1.22 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: uaudio.c,v 1.67 2003/05/03 18:11:41 wiz Exp $ */ /* @@ -360,12 +360,13 @@ USB_ATTACH(uaudio) USB_ATTACH_START(uaudio, sc, uaa); usb_interface_descriptor_t *id; usb_config_descriptor_t *cdesc; - char devinfo[1024]; + char *devinfop; usbd_status err; int i, j, found; - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); - printf(": %s\n", devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); + printf(": %s\n", devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = uaa->device; diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index d98bcc7fbe8..95693eea4db 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsa.c,v 1.10 2005/03/18 00:33:28 reyk Exp $ */ +/* $OpenBSD: ubsa.c,v 1.11 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: ubsa.c,v 1.5 2002/11/25 00:51:33 fvdl Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. @@ -263,15 +263,16 @@ USB_ATTACH(ubsa) usb_config_descriptor_t *cdesc; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; const char *devname = USBDEVNAME(sc->sc_dev); usbd_status err; struct ucom_attach_args uca; int i; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); + USB_ATTACH_SETUP; + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = dev; diff --git a/sys/dev/usb/udsbr.c b/sys/dev/usb/udsbr.c index 29e830f5d78..ae8685db6f5 100644 --- a/sys/dev/usb/udsbr.c +++ b/sys/dev/usb/udsbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udsbr.c,v 1.7 2004/07/08 22:18:44 deraadt Exp $ */ +/* $OpenBSD: udsbr.c,v 1.8 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: udsbr.c,v 1.7 2002/07/11 21:14:27 augustss Exp $ */ /* @@ -122,14 +122,15 @@ USB_ATTACH(udsbr) { USB_ATTACH_START(udsbr, sc, uaa); usbd_device_handle dev = uaa->device; - char devinfo[1024]; + char *devinfop; usbd_status err; DPRINTFN(10,("udsbr_attach: sc=%p\n", sc)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, UDSBR_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c index d41cc9a89b3..0a16f941992 100644 --- a/sys/dev/usb/ueagle.c +++ b/sys/dev/usb/ueagle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ueagle.c,v 1.5 2005/07/30 07:16:09 brad Exp $ */ +/* $OpenBSD: ueagle.c,v 1.6 2005/08/01 05:36:48 brad Exp $ */ /*- * Copyright (c) 2003-2005 @@ -157,7 +157,7 @@ USB_ATTACH(ueagle) { USB_ATTACH_START(ueagle, sc, uaa); struct ifnet *ifp = &sc->sc_if; - char devinfo[1024]; + char *devinfop; uint8_t addr[ETHER_ADDR_LEN]; sc->sc_udev = uaa->device; @@ -179,8 +179,9 @@ USB_ATTACH(ueagle) USB_ATTACH_SUCCESS_RETURN; } - usbd_devinfo(sc->sc_udev, 0, devinfo, sizeof devinfo); - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); if (usbd_set_config_no(sc->sc_udev, UEAGLE_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index 3e90187d34e..fa18900d6b4 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uftdi.c,v 1.24 2005/05/24 03:26:05 pascoe Exp $ */ +/* $OpenBSD: uftdi.c,v 1.25 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: uftdi.c,v 1.14 2003/02/23 04:20:07 simonb Exp $ */ /* @@ -178,7 +178,7 @@ USB_ATTACH(uftdi) usbd_interface_handle iface; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); int i; usbd_status err; @@ -204,9 +204,10 @@ USB_ATTACH(uftdi) } else iface = uaa->iface; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); id = usbd_get_interface_descriptor(iface); diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 777c2916cdd..e62083e9dd2 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.31 2004/10/31 12:10:52 dlg Exp $ */ +/* $OpenBSD: ugen.c,v 1.32 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -199,13 +199,14 @@ USB_ATTACH(ugen) { USB_ATTACH_START(ugen, sc, uaa); usbd_device_handle udev; - char devinfo[1024]; + char *devinfop; usbd_status err; int conf; - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = udev = uaa->device; diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 4ac45aaa2ba..370adb84dbc 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.10 2004/07/08 22:18:44 deraadt Exp $ */ +/* $OpenBSD: uhidev.c,v 1.11 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -113,15 +113,17 @@ USB_ATTACH(uhidev) int repsizes[256]; void *desc; usbd_status err; - char devinfo[1024]; + char *devinfop; sc->sc_udev = uaa->device; sc->sc_iface = iface; id = usbd_get_interface_descriptor(iface); - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); + + devinfop = usbd_devinfo_alloc(uaa->device, 0); USB_ATTACH_SETUP; printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), - devinfo, id->bInterfaceClass, id->bInterfaceSubClass); + devinfop, id->bInterfaceClass, id->bInterfaceSubClass); + usbd_devinfo_free(devinfop); (void)usbd_set_idle(iface, 0, 0); #if 0 diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 04c10cdec78..6371b22b6d6 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.31 2005/03/28 02:34:16 dlg Exp $ */ +/* $OpenBSD: uhub.c,v 1.32 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ @@ -153,7 +153,7 @@ USB_ATTACH(uhub) { USB_ATTACH_START(uhub, sc, uaa); usbd_device_handle dev = uaa->device; - char devinfo[1024]; + char *devinfop; usbd_status err; struct usbd_hub *hub = NULL; usb_device_request_t req; @@ -165,9 +165,11 @@ USB_ATTACH(uhub) DPRINTFN(1,("uhub_attach\n")); sc->sc_hub = dev; - usbd_devinfo(dev, 1, devinfo, sizeof devinfo); + + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_index(dev, 0, 1); if (err) { diff --git a/sys/dev/usb/uipaq.c b/sys/dev/usb/uipaq.c index ed97f8c1be1..b7617ade5f2 100644 --- a/sys/dev/usb/uipaq.c +++ b/sys/dev/usb/uipaq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */ +/* $OpenBSD: uipaq.c,v 1.2 2005/08/01 05:36:48 brad Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -152,7 +152,7 @@ USB_ATTACH(uipaq) usbd_interface_handle iface; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); int i; usbd_status err; @@ -175,9 +175,10 @@ USB_ATTACH(uipaq) goto bad; } - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); sc->sc_flags = uipaq_lookup(uaa->vendor, uaa->product)->uv_flags; diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 987633de297..7459cf346b8 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ulpt.c,v 1.19 2004/07/08 22:18:44 deraadt Exp $ */ +/* $OpenBSD: ulpt.c,v 1.20 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: ulpt.c,v 1.57 2003/01/05 10:19:42 scw Exp $ */ /* $FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $ */ @@ -207,16 +207,18 @@ USB_ATTACH(ulpt) usb_interface_descriptor_t *id, *iend; usb_config_descriptor_t *cdesc; usbd_status err; - char devinfo[1024]; + char *devinfop; usb_endpoint_descriptor_t *ed; u_int8_t epcount; int i, altno; DPRINTFN(10,("ulpt_attach: sc=%p\n", sc)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), - devinfo, ifcd->bInterfaceClass, ifcd->bInterfaceSubClass); + devinfop, ifcd->bInterfaceClass, ifcd->bInterfaceSubClass); + usbd_devinfo_free(devinfop); /* XXX * Stepping through the alternate settings needs to be abstracted out. @@ -318,8 +320,8 @@ USB_ATTACH(ulpt) req.bRequest = UR_GET_DEVICE_ID; USETW(req.wValue, cd->bConfigurationValue); USETW2(req.wIndex, id->bInterfaceNumber, id->bAlternateSetting); - USETW(req.wLength, sizeof devinfo - 1); - err = usbd_do_request_flags(dev, &req, devinfo, USBD_SHORT_XFER_OK, + USETW(req.wLength, DEVINFOSIZE - 1); + err = usbd_do_request_flags(dev, &req, devinfop, USBD_SHORT_XFER_OK, &alen, USBD_DEFAULT_TIMEOUT); if (err) { printf("%s: cannot get device id\n", USBDEVNAME(sc->sc_dev)); @@ -327,13 +329,13 @@ USB_ATTACH(ulpt) printf("%s: empty device id, no printer connected?\n", USBDEVNAME(sc->sc_dev)); } else { - /* devinfo now contains an IEEE-1284 device ID */ - len = ((devinfo[0] & 0xff) << 8) | (devinfo[1] & 0xff); - if (len > sizeof devinfo - 3) - len = sizeof devinfo - 3; + /* devinfop now contains an IEEE-1284 device ID */ + len = ((devinfop[0] & 0xff) << 8) | (devinfop[1] & 0xff); + if (len > DEVINFOSIZE - 3) + len = DEVINFOSIZE - 3; devinfo[len] = 0; printf("%s: device id <", USBDEVNAME(sc->sc_dev)); - ieee1284_print_id(devinfo+2); + ieee1284_print_id(devinfop+2); printf(">\n"); } } diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 6dff4f0b197..5c22a5bac58 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.42 2005/05/24 04:51:04 pascoe Exp $ */ +/* $OpenBSD: umass.c,v 1.43 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */ /* @@ -304,12 +304,14 @@ USB_ATTACH(umass) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; const char *sWire, *sCommand; - char devinfo[1024]; + char *devinfop; usbd_status err; int i, bno, error; - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); USB_ATTACH_SETUP; + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = uaa->device; sc->sc_iface = uaa->iface; @@ -381,8 +383,6 @@ USB_ATTACH(umass) } } - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); - switch (sc->sc_wire) { case UMASS_WPROTO_CBI: sWire = "CBI"; diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index e52e8be45a9..71fd9ad5eaa 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umct.c,v 1.13 2004/09/20 21:34:46 deraadt Exp $ */ +/* $OpenBSD: umct.c,v 1.14 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: umct.c,v 1.10 2003/02/23 04:20:07 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -177,15 +177,16 @@ USB_ATTACH(umct) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); usbd_status err; int i; struct ucom_attach_args uca; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = dev; sc->sc_product = uaa->product; diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c index bb029470c63..ce19ae92f38 100644 --- a/sys/dev/usb/umidi.c +++ b/sys/dev/usb/umidi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umidi.c,v 1.11 2004/11/20 01:29:37 jsg Exp $ */ +/* $OpenBSD: umidi.c,v 1.12 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -162,13 +162,14 @@ USB_ATTACH(umidi) { usbd_status err; USB_ATTACH_START(umidi, sc, uaa); - char devinfo[1024]; + char *devinfop; int i; DPRINTFN(1,("umidi_attach\n")); - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); sc->sc_iface = uaa->iface; sc->sc_udev = uaa->device; diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 2eb62dd78d1..ed5da79db46 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umodem.c,v 1.17 2004/07/11 12:16:46 deraadt Exp $ */ +/* $OpenBSD: umodem.c,v 1.18 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: umodem.c,v 1.45 2002/09/23 05:51:23 simonb Exp $ */ /* @@ -201,13 +201,13 @@ USB_ATTACH(umodem) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; usb_cdc_cm_descriptor_t *cmd; - char devinfo[1024]; + char *devinfop; usbd_status err; int data_ifcno; int i; struct ucom_attach_args uca; - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; sc->sc_udev = dev; @@ -215,7 +215,8 @@ USB_ATTACH(umodem) id = usbd_get_interface_descriptor(sc->sc_ctl_iface); printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), - devinfo, id->bInterfaceClass, id->bInterfaceSubClass); + devinfop, id->bInterfaceClass, id->bInterfaceSubClass); + usbd_devinfo_free(devinfop); sc->sc_ctl_iface_no = id->bInterfaceNumber; umodem_get_caps(dev, &sc->sc_cm_cap, &sc->sc_acm_cap); diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index 33b0ad6f8dd..658fbd5e40f 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uplcom.c,v 1.23 2005/07/04 00:37:21 deraadt Exp $ */ +/* $OpenBSD: uplcom.c,v 1.24 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: uplcom.c,v 1.29 2002/09/23 05:51:23 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -220,15 +220,16 @@ USB_ATTACH(uplcom) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); usbd_status err; int i; struct ucom_attach_args uca; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); + USB_ATTACH_SETUP; + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = dev; diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index d0b30a72ffd..4848370fff7 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: urio.c,v 1.18 2004/07/08 22:18:44 deraadt Exp $ */ +/* $OpenBSD: urio.c,v 1.19 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: urio.c,v 1.15 2002/10/23 09:14:02 jdolecek Exp $ */ /* @@ -163,7 +163,7 @@ USB_ATTACH(urio) USB_ATTACH_START(urio, sc, uaa); usbd_device_handle dev = uaa->device; usbd_interface_handle iface; - char devinfo[1024]; + char *devinfop; usbd_status err; usb_endpoint_descriptor_t *ed; u_int8_t epcount; @@ -171,9 +171,10 @@ USB_ATTACH(urio) DPRINTFN(10,("urio_attach: sc=%p\n", sc)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, URIO_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 7f8fecb669d..bcdfbed79a1 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.37 2005/07/18 02:43:27 fgsch Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.38 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -77,6 +77,7 @@ extern int usbdebug; #endif Static usbd_status usbd_set_config(usbd_device_handle, int); +Static void usbd_devinfo(usbd_device_handle, int, char *, size_t); Static void usbd_devinfo_vp(usbd_device_handle, char *, char *, int); Static char *usbd_get_string(usbd_device_handle, int, char *); Static int usbd_getnewaddr(usbd_bus_handle bus); @@ -312,7 +313,7 @@ usbd_printBCD(char *cp, size_t len, int bcd) return (l); } -void +Static void usbd_devinfo(usbd_device_handle dev, int showclass, char *base, size_t len) { usb_device_descriptor_t *udd = &dev->ddesc; @@ -344,6 +345,22 @@ usbd_devinfo(usbd_device_handle dev, int showclass, char *base, size_t len) *cp = 0; } +char * +usbd_devinfo_alloc(usbd_device_handle dev, int showclass) +{ + char *devinfop; + + devinfop = malloc(DEVINFOSIZE, M_TEMP, M_WAITOK); + usbd_devinfo(dev, showclass, devinfop, DEVINFOSIZE); + return devinfop; +} + +void +usbd_devinfo_free(char *devinfop) +{ + free(devinfop, M_TEMP); +} + /* Delay for a certain number of ms */ void usb_delay_ms(usbd_bus_handle bus, u_int ms) diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 23f0b29868f..11bc0d8e150 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.h,v 1.23 2004/12/12 06:13:15 dlg Exp $ */ +/* $OpenBSD: usbdi.h,v 1.24 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: usbdi.h,v 1.62 2002/07/11 21:14:35 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -93,6 +93,8 @@ typedef void (*usbd_callback)(usbd_xfer_handle, usbd_private_handle, #define USB_CDEV_MAJOR 108 #endif +#define DEVINFOSIZE 1024 + usbd_status usbd_open_pipe(usbd_interface_handle iface, u_int8_t address, u_int8_t flags, usbd_pipe_handle *pipe); usbd_status usbd_close_pipe(usbd_pipe_handle pipe); @@ -169,7 +171,9 @@ const char *usbd_errstr(usbd_status err); void usbd_add_dev_event(int, usbd_device_handle); void usbd_add_drv_event(int, usbd_device_handle, device_ptr_t); -void usbd_devinfo(usbd_device_handle, int, char *, size_t); +char *usbd_devinfo_alloc(usbd_device_handle dev, int showclass); +void usbd_devinfo_free(char *devinfop); + const struct usbd_quirks *usbd_get_quirks(usbd_device_handle); usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor (usbd_interface_handle iface, u_int8_t address); diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 6e0f6e179a8..d1c219f2469 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uscanner.c,v 1.17 2004/07/08 22:18:45 deraadt Exp $ */ +/* $OpenBSD: uscanner.c,v 1.18 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: uscanner.c,v 1.40 2003/01/27 00:32:44 wiz Exp $ */ /* @@ -307,13 +307,14 @@ USB_ATTACH(uscanner) USB_ATTACH_START(uscanner, sc, uaa); usb_interface_descriptor_t *id = 0; usb_endpoint_descriptor_t *ed, *ed_bulkin = NULL, *ed_bulkout = NULL; - char devinfo[1024]; + char *devinfop; int i; usbd_status err; - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags; diff --git a/sys/dev/usb/usscanner.c b/sys/dev/usb/usscanner.c index ed95dd48dac..056ace1f462 100644 --- a/sys/dev/usb/usscanner.c +++ b/sys/dev/usb/usscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usscanner.c,v 1.9 2004/07/08 22:18:45 deraadt Exp $ */ +/* $OpenBSD: usscanner.c,v 1.10 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: usscanner.c,v 1.6 2001/01/23 14:04:14 augustss Exp $ */ /* @@ -206,7 +206,7 @@ USB_ATTACH(usscanner) USB_ATTACH_START(usscanner, sc, uaa); usbd_device_handle dev = uaa->device; usbd_interface_handle iface; - char devinfo[1024]; + char *devinfop; usbd_status err; usb_endpoint_descriptor_t *ed; u_int8_t epcount; @@ -214,9 +214,10 @@ USB_ATTACH(usscanner) DPRINTFN(10,("usscanner_attach: sc=%p\n", sc)); - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, USSCANNER_CONFIG_NO, 1); if (err) { diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index 7f31703ebce..85614940442 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvisor.c,v 1.20 2005/02/23 02:24:30 deraadt Exp $ */ +/* $OpenBSD: uvisor.c,v 1.21 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: uvisor.c,v 1.21 2003/08/03 21:59:26 nathanw Exp $ */ /* @@ -218,7 +218,7 @@ USB_ATTACH(uvisor) struct uvisor_connection_info coninfo; struct uvisor_palm_connection_info palmconinfo; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); int i, j, hasin, hasout, port; usbd_status err; @@ -241,9 +241,10 @@ USB_ATTACH(uvisor) goto bad; } - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); sc->sc_flags = uvisor_lookup(uaa->vendor, uaa->product)->uv_flags; diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index fbb6ca36e81..93e575472e7 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvscom.c,v 1.5 2004/07/11 09:27:54 deraadt Exp $ */ +/* $OpenBSD: uvscom.c,v 1.6 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: uvscom.c,v 1.9 2003/02/12 15:36:20 ichiro Exp $ */ /*- * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. @@ -274,15 +274,16 @@ USB_ATTACH(uvscom) usb_config_descriptor_t *cdesc; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; const char *devname = USBDEVNAME(sc->sc_dev); usbd_status err; int i; struct ucom_attach_args uca; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = dev; diff --git a/sys/dev/usb/uyap.c b/sys/dev/usb/uyap.c index a03903edf25..d93760c8749 100644 --- a/sys/dev/usb/uyap.c +++ b/sys/dev/usb/uyap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uyap.c,v 1.8 2004/12/19 15:20:13 deraadt Exp $ */ +/* $OpenBSD: uyap.c,v 1.9 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: uyap.c,v 1.6 2002/07/11 21:14:37 augustss Exp $ */ /* @@ -95,11 +95,13 @@ USB_ATTACH(uyap) { USB_ATTACH_START(uyap, sc, uaa); usbd_device_handle dev = uaa->device; - char devinfo[1024]; + char *devinfop; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); + printf("%s: downloading firmware\n", USBDEVNAME(sc->sc_dev)); sc->sc_udev = dev; |