Date: Thu, 1 Mar 2018 01:49:36 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330137 - head/sys/dev/pci Message-ID: <201803010149.w211naXG009928@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803010149.w211naXG009928>