From 5ab0e60b1d5517b710493f86c32e06a57507cfed Mon Sep 17 00:00:00 2001 From: Jonathan Armani Date: Thu, 11 Mar 2010 10:23:09 +0000 Subject: Correct a wrong printf and move a check than should be before the debug. Found when looking at ckuethe problem. with and ok fabien@, "definitivly" mk@, "that diff can go in" kettenis --- sys/dev/usb/if_urndis.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c index 8b25514a12b..4203203d605 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.15 2010/03/07 17:17:33 mk Exp $ */ +/* $OpenBSD: if_urndis.c,v 1.16 2010/03/11 10:23:08 armani Exp $ */ /* * Copyright (c) 2010 Jonathan Armani @@ -784,6 +784,15 @@ urndis_decap(struct urndis_softc *sc, struct urndis_chain *c, u_int32_t len) DPRINTF(("%s: urndis_decap buffer size left %u\n", DEVNAME(sc), len)); + if (len < sizeof(*msg)) { + printf("%s: urndis_decap invalid buffer len %u < " + "minimum header %u\n", + DEVNAME(sc), + len, + sizeof(*msg)); + return; + } + DPRINTF(("%s: urndis_decap len %u data(off:%u len:%u) " "oobdata(off:%u len:%u nb:%u) perpacket(off:%u len:%u)\n", DEVNAME(sc), @@ -796,14 +805,6 @@ urndis_decap(struct urndis_softc *sc, struct urndis_chain *c, u_int32_t len) letoh32(msg->rm_pktinfooffset), letoh32(msg->rm_pktinfooffset))); - if (len < sizeof(*msg)) { - printf("%s: urndis_decap invalid buffer len %u < " - "minimum header %u\n", - DEVNAME(sc), - letoh32(msg->rm_len), - sizeof(*msg)); - return; - } if (letoh32(msg->rm_type) != REMOTE_NDIS_PACKET_MSG) { printf("%s: urndis_decap invalid type 0x%x != 0x%x\n", DEVNAME(sc), -- cgit v1.2.3