From owner-svn-src-head@freebsd.org Thu Mar 1 01:49:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 190F5F365BD; Thu, 1 Mar 2018 01:49:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB1AA71257; Thu, 1 Mar 2018 01:49:36 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5FAC21ADE; Thu, 1 Mar 2018 01:49:36 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w211naFm009929; Thu, 1 Mar 2018 01:49:36 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w211naXG009928; Thu, 1 Mar 2018 01:49:36 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803010149.w211naXG009928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 1 Mar 2018 01:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330137 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 330137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 01:49:37 -0000 Author: cem Date: Thu Mar 1 01:49:36 2018 New Revision: 330137 URL: https://svnweb.freebsd.org/changeset/base/330137 Log: pci_ioctl: Avoid returning uninitialized error value if user provided empty buffer In the weird case where the user-provided buffer was zero bytes, we could break out of PCIOCGETCONF and return without initializing error. In this case, initialize error to zero -- we successfully did nothing, as requested. Reported by: Coverity Sponsored by: Dell EMC Isilon Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Thu Mar 1 00:58:59 2018 (r330136) +++ head/sys/dev/pci/pci_user.c Thu Mar 1 01:49:36 2018 (r330137) @@ -762,8 +762,10 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, * tell the user that there are more matches * left. */ - if (cio->num_matches >= ionum) + if (cio->num_matches >= ionum) { + error = 0; break; + } #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32