From owner-p4-projects@FreeBSD.ORG Sun Sep 14 17:14:44 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 18B841065671; Sun, 14 Sep 2008 17:14:44 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D15BB1065673 for ; Sun, 14 Sep 2008 17:14:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B05898FC19 for ; Sun, 14 Sep 2008 17:14:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8EHEhaA017557 for ; Sun, 14 Sep 2008 17:14:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8EHEh73017550 for perforce@freebsd.org; Sun, 14 Sep 2008 17:14:43 GMT (envelope-from hselasky@FreeBSD.org) Date: Sun, 14 Sep 2008 17:14:43 GMT Message-Id: <200809141714.m8EHEh73017550@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 149764 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Sep 2008 17:14:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=149764 Change 149764 by hselasky@hselasky_laptop001 on 2008/09/14 17:14:33 Remove unused "curoff" variable and add more comments. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#31 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#31 (text+ko) ==== @@ -2699,7 +2699,6 @@ usb2_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len) { struct usb2_symlink *ps; - uint32_t curoff = 0; uint32_t temp; uint32_t delta = 0; uint8_t len; @@ -2709,14 +2708,22 @@ TAILQ_FOREACH(ps, &usb2_sym_head, sym_entry) { + /* + * Compute total length of source and destination symlink + * strings pluss one length byte and two NUL bytes: + */ temp = ps->src_len + ps->dst_len + 3; if (temp > 255) { + /* + * Skip entry because this length cannot fit + * into one byte: + */ continue; } if (startentry != 0) { + /* decrement read offset */ startentry--; - curoff += temp; continue; } if (temp > user_len) { @@ -2766,7 +2773,6 @@ } delta += 1; - curoff += temp; user_len -= temp; }