From owner-freebsd-bugs@FreeBSD.ORG Thu Oct 11 11:49:21 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6667A571 for ; Thu, 11 Oct 2012 11:49:21 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [8.8.178.135]) by mx1.freebsd.org (Postfix) with ESMTP id 3D7018FC22 for ; Thu, 11 Oct 2012 11:49:21 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q9BBnLGG062625 for ; Thu, 11 Oct 2012 11:49:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q9BBnLX8062624; Thu, 11 Oct 2012 11:49:21 GMT (envelope-from gnats) Resent-Date: Thu, 11 Oct 2012 11:49:21 GMT Resent-Message-Id: <201210111149.q9BBnLX8062624@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Erik Cederstrand Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 80319E5D for ; Thu, 11 Oct 2012 07:49:24 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 69B678FC12 for ; Thu, 11 Oct 2012 07:49:24 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q9B7nNI0050114 for ; Thu, 11 Oct 2012 07:49:23 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id q9B7nNK5050113; Thu, 11 Oct 2012 07:49:23 GMT (envelope-from nobody) Message-Id: <201210110749.q9B7nNK5050113@red.freebsd.org> Date: Thu, 11 Oct 2012 07:49:23 GMT From: Erik Cederstrand To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/172599: Null function pointer in ipfilter X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 11:49:21 -0000 >Number: 172599 >Category: misc >Synopsis: Null function pointer in ipfilter >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 11 11:49:20 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Erik Cederstrand >Release: CURRENT >Organization: >Environment: >Description: Based on Clang Static Analyzer report http://scan.freebsd.your.org/freebsd-head/LATEST/sbin/report-ivw4lE.html.gz#EndPath There seems to be a case of inverse logic. The comment lines 2085- 2088 says the function should only be called if it is a valid pointer, but the opposite happens. >How-To-Repeat: >Fix: Swap the logic. This is in line with a similar condition in line 2319. Patch attached with submission follows: Index: head/sys/contrib/ipfilter/netinet/fil.c =================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c (revision 241370) +++ head/sys/contrib/ipfilter/netinet/fil.c (working copy) @@ -2091,7 +2091,7 @@ frentry_t *frs; ATOMIC_INC64(fr->fr_hits); - if ((fr->fr_func != NULL) && + if ((fr->fr_func == NULL) || (fr->fr_func == (ipfunc_t)-1)) continue; >Release-Note: >Audit-Trail: >Unformatted: