From owner-svn-src-head@freebsd.org Thu Aug 16 17:06:52 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 3B487106F143; Thu, 16 Aug 2018 17:06:52 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gate2.funkthat.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9730C8E0A6; Thu, 16 Aug 2018 17:06:51 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.15.2/8.15.2) with ESMTPS id w7GH6o0f066705 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 16 Aug 2018 10:06:50 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.15.2/8.15.2/Submit) id w7GH6osp066704; Thu, 16 Aug 2018 10:06:50 -0700 (PDT) (envelope-from jmg) Date: Thu, 16 Aug 2018 10:06:50 -0700 From: John-Mark Gurney To: Marcelo Araujo Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r337887 - head/usr.sbin/bhyve Message-ID: <20180816170650.GX97145@funkthat.com> Mail-Followup-To: John-Mark Gurney , Marcelo Araujo , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201808160631.w7G6VsS8064579@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201808160631.w7G6VsS8064579@repo.freebsd.org> X-Operating-System: FreeBSD 11.0-RELEASE-p7 amd64 X-PGP-Fingerprint: D87A 235F FB71 1F3F 55B7 ED9B D5FF 5A51 C0AC 3D65 X-Files: The truth is out there X-URL: https://www.funkthat.com/ X-Resume: https://www.funkthat.com/~jmg/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (gold.funkthat.com [127.0.0.1]); Thu, 16 Aug 2018 10:06:50 -0700 (PDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 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, 16 Aug 2018 17:06:52 -0000 Marcelo Araujo wrote this message on Thu, Aug 16, 2018 at 06:31 +0000: > Author: araujo > Date: Thu Aug 16 06:31:54 2018 > New Revision: 337887 > URL: https://svnweb.freebsd.org/changeset/base/337887 > > Log: > Add a comment explaining how the PSN works and why there is no need for > a null terminator. Also mark CID 1394825 as intentional. > > Reported by: Coverity > CID: 1394825 > MFC after: 1 week > Sponsored by: iXsystems Inc. > > Modified: > head/usr.sbin/bhyve/pci_nvme.c > > Modified: head/usr.sbin/bhyve/pci_nvme.c > ============================================================================== > --- head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:20:25 2018 (r337886) > +++ head/usr.sbin/bhyve/pci_nvme.c Thu Aug 16 06:31:54 2018 (r337887) > @@ -1714,6 +1714,11 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o [...] > memset(sc->ctrldata.sn, 0, sizeof(sc->ctrldata.sn)); > strncpy(sc->ctrldata.sn, config, > sizeof(sc->ctrldata.sn)); This memset is unneeded, as strncpy will write NUL bytes to fill out the buffer: If src is less than len characters long, the remainder of dst is filled with `\0' characters. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."