From owner-svn-src-head@freebsd.org Thu Aug 16 19:18:25 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 274F91073AB8 for ; Thu, 16 Aug 2018 19:18:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1F5C748DB for ; Thu, 16 Aug 2018 19:18:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id q19-v6so4779614ioh.11 for ; Thu, 16 Aug 2018 12:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=/Io/AE8ac9YGAGnEvOdoTrqZ68PP0uSUqehATenl3cA=; b=aEcfKe92ZCbECgK0Ah6CFZ+CT9UbJ26I7KFKgPnPCq3AbpZ03rBf0f2Fimhcgt7BiC SIk8A2db62YkW2FwOPi65y/r1jcCrgghgavCUe1F9yex7c0Yqos+4xHC7Jj7bX1bdIWh g3uO7GJ3Xi8gWy8A1avG1BwWDizUIZ/FgUpnkcypQqDY+0AAvr3y7W0wWg6Hw18vCvVK FSrQflf/RaoWBUH1lctwNiyhMLnb9lN8UQCALB2iTDrbAoQIGSLWRbFCNH53nGXBZ/0U l1t1P0jvP7EwKXO3lpwHlsePg6lOz+huzLh6+qJ8f+Y0bc2r/P8+CTJgdHDl/hBI9/3l v1SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=/Io/AE8ac9YGAGnEvOdoTrqZ68PP0uSUqehATenl3cA=; b=qZ1s99/TFFUU41LOYQHu0PcCatY/loCSlxyQdzh4TpQie8/7FTHl0jpQ96UqwtejPl AyTAvpM3LjZzIXjnl7P1e/Wcm9SYQNRxgw06nZ8nmho/tADsgbyM3cm/ohYpeOB6l5T/ 2eJP5MfxaikuNm1++oHLYxucZvZRX54pPL70OX0x0I4p97NS+0jG/yBw6OaPmNlLkEkr Ph9JSjTGmcPhN5InMb46pvdIS9esg/+e+wx4TbzC3mYMvmHWVJJTFYSYv/lzlflXIunD jCQ2uT//4fCN9KoMQGxNJoLl0R9LHsfIYSGy0XKFg+H5Vjkc+Dp/16shFDr/DcMvMgth e2TA== X-Gm-Message-State: AOUpUlF96wR1wEh7j0JI/d/He9gMYJR62obz4Ryrztp0oM7nSSyqPtmX cxTzfXcK3aPGRL30t0gVOwngSUUhdgpIvI57M7xJdQ== X-Google-Smtp-Source: AA+uWPwx1F7gvdT+UTykIal0MNj9vPx3KYQ4laSIyhkygRwCI7dJKX7vUeI2l2gSorIaChH9k6exVeplRYBHocl//pM= X-Received: by 2002:a6b:d004:: with SMTP id x4-v6mr26394356ioa.299.1534447103913; Thu, 16 Aug 2018 12:18:23 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:257:0:0:0:0:0 with HTTP; Thu, 16 Aug 2018 12:18:23 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180816170650.GX97145@funkthat.com> References: <201808160631.w7G6VsS8064579@repo.freebsd.org> <20180816170650.GX97145@funkthat.com> From: Warner Losh Date: Thu, 16 Aug 2018 13:18:23 -0600 X-Google-Sender-Auth: FMwZPbUhUFcAP-Cpyu3j4bCH8vM Message-ID: Subject: Re: svn commit: r337887 - head/usr.sbin/bhyve To: John-Mark Gurney , Marcelo Araujo , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 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 19:18:25 -0000 On Thu, Aug 16, 2018 at 11:06 AM, John-Mark Gurney wrote: > 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. > It also looks like the comment was wrong. The newest NVMe standards say these fields should be 7-bit and space-padded. Warner