summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/microcode/kue/build.c22
-rw-r--r--sys/dev/usb/if_kue.c10
2 files changed, 18 insertions, 14 deletions
diff --git a/sys/dev/microcode/kue/build.c b/sys/dev/microcode/kue/build.c
index 892773e3f59..aaf8003279e 100644
--- a/sys/dev/microcode/kue/build.c
+++ b/sys/dev/microcode/kue/build.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: build.c,v 1.3 2005/05/17 18:48:52 jason Exp $ */
+/* $OpenBSD: build.c,v 1.4 2007/01/09 16:30:06 deraadt Exp $ */
/*
* Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
@@ -41,17 +41,21 @@ main(int argc, char *argv[])
kf = (struct kue_firmware *)malloc(len);
bzero(kf, len);
- kf->codeseglen = sizeof(kue_code_seg);
- kf->fixseglen = sizeof(kue_fix_seg);
- kf->trigseglen = sizeof(kue_trig_seg);
+ kf->codeseglen = htonl(sizeof(kue_code_seg));
+ kf->fixseglen = htonl(sizeof(kue_fix_seg));
+ kf->trigseglen = htonl(sizeof(kue_trig_seg));
- bcopy(kue_code_seg, &kf->data[0], kf->codeseglen);
- bcopy(kue_fix_seg, &kf->data[kf->codeseglen], kf->fixseglen);
- bcopy(kue_trig_seg, &kf->data[kf->codeseglen + kf->fixseglen],
- kf->trigseglen);
+ bcopy(kue_code_seg, &kf->data[0],
+ sizeof(kue_code_seg));
+ bcopy(kue_fix_seg, &kf->data[sizeof(kue_code_seg)],
+ sizeof(kue_fix_seg));
+ bcopy(kue_trig_seg,
+ &kf->data[sizeof(kue_code_seg) + sizeof(kue_fix_seg)],
+ sizeof(kue_trig_seg));
printf("creating %s length %d [%d+%d+%d]\n",
- FILENAME, len, kf->codeseglen, kf->fixseglen, kf->trigseglen);
+ FILENAME, len, sizeof(kue_code_seg), sizeof(kue_fix_seg),
+ sizeof(kue_trig_seg));
fd = open(FILENAME, O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (fd == -1)
err(1, FILENAME);
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index 40c73d80b59..a2a0937d570 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.42 2006/06/23 06:27:11 miod Exp $ */
+/* $OpenBSD: if_kue.c,v 1.43 2007/01/09 16:30:08 deraadt Exp $ */
/* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -284,7 +284,7 @@ kue_load_fw(struct kue_softc *sc)
DPRINTFN(1,("%s: kue_load_fw: download code_seg\n",
USBDEVNAME(sc->kue_dev)));
err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN,
- 0, (void *)&fw->data[0], fw->codeseglen);
+ 0, (void *)&fw->data[0], ntohl(fw->codeseglen));
if (err) {
printf("%s: failed to load code segment: %s\n",
USBDEVNAME(sc->kue_dev), usbd_errstr(err));
@@ -296,7 +296,7 @@ kue_load_fw(struct kue_softc *sc)
DPRINTFN(1,("%s: kue_load_fw: download fix_seg\n",
USBDEVNAME(sc->kue_dev)));
err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN,
- 0, (void *)&fw->data[fw->codeseglen], fw->fixseglen);
+ 0, (void *)&fw->data[ntohl(fw->codeseglen)], ntohl(fw->fixseglen));
if (err) {
printf("%s: failed to load fixup segment: %s\n",
USBDEVNAME(sc->kue_dev), usbd_errstr(err));
@@ -308,8 +308,8 @@ kue_load_fw(struct kue_softc *sc)
DPRINTFN(1,("%s: kue_load_fw: download trig_seg\n",
USBDEVNAME(sc->kue_dev)));
err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN,
- 0, (void *)&fw->data[fw->codeseglen + fw->fixseglen],
- fw->trigseglen);
+ 0, (void *)&fw->data[ntohl(fw->codeseglen) + ntohl(fw->fixseglen)],
+ ntohl(fw->trigseglen));
if (err) {
printf("%s: failed to load trigger segment: %s\n",
USBDEVNAME(sc->kue_dev), usbd_errstr(err));