From owner-p4-projects@FreeBSD.ORG Sat Jan 21 13:54:45 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3BA2C16A422; Sat, 21 Jan 2006 13:54:45 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EB10E16A41F for ; Sat, 21 Jan 2006 13:54:44 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4CF743D46 for ; Sat, 21 Jan 2006 13:54:44 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k0LDsigW082385 for ; Sat, 21 Jan 2006 13:54:44 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k0LDsi85082382 for perforce@freebsd.org; Sat, 21 Jan 2006 13:54:44 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sat, 21 Jan 2006 13:54:44 GMT Message-Id: <200601211354.k0LDsi85082382@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 90077 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: Sat, 21 Jan 2006 13:54:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=90077 Change 90077 by rwatson@rwatson_sesame on 2006/01/21 13:53:51 More avoidance of hand-calculated token sizes. Submitted by: phk Found with: FlexeLint Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#27 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#27 (text+ko) ==== @@ -151,8 +151,8 @@ u_int16_t pad0_16 = 0; u_int16_t pad0_32 = 0; - GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 2*sizeof(u_int16_t) + - 3*sizeof(u_int32_t) + sizeof(u_int64_t) + sizeof(u_int32_t)); + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 2 * sizeof(u_int16_t) + + 3 * sizeof(u_int32_t) + sizeof(u_int64_t) + sizeof(u_int32_t)); if (t == NULL) return (NULL); @@ -296,7 +296,8 @@ u_char *dptr = NULL; int i; - GET_TOKEN_AREA(t, dptr, n * 4 + 3); + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + + n * sizeof(u_int32_t)); if (t == NULL) return (NULL); @@ -318,7 +319,7 @@ token_t *t; u_char *dptr = NULL; - GET_TOKEN_AREA(t, dptr, 5); + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int32_t)); if (t == NULL) return (NULL); @@ -340,7 +341,7 @@ u_char *dptr = NULL; u_int32_t type = AF_INET6; - GET_TOKEN_AREA(t, dptr, 21); + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 5 * sizeof(u_int32_t)); if (t == NULL) return (NULL); @@ -389,7 +390,7 @@ u_char *dptr = NULL; - GET_TOKEN_AREA(t, dptr, 6); + GET_TOKEN_AREA(t, dptr, 2 * sizeof(u_char) + sizeof(u_int32_t)); if (t == NULL) return (NULL); @@ -450,7 +451,6 @@ return (t); } - /* * token ID 1 byte * port IP address 2 bytes