From owner-svn-src-head@freebsd.org Thu Aug 16 23:04:08 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 EA3E6107970E; Thu, 16 Aug 2018 23:04:07 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (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 546477D3C3; Thu, 16 Aug 2018 23:04:07 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-lf1-x132.google.com with SMTP id b22-v6so4596791lfa.3; Thu, 16 Aug 2018 16:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=coxXcZkR2y5AZbXSv5WQymsQzrAZmI5iDjlOfIM7shY=; b=Gb1+NZbisNIgTpEqgRR5Y+13v+yP23X1p/bFpTCXTDyQ53Ru0Hszc2rde1VOl66HKk MWt0iBgBRfTBL6nGmVMFDXd2Xs1A7cJvzr9hlTewqKbORUsxfn3ixn39FG32gpaX/1Y9 W9r9w/19rCldlxqPA4AGr1FjqlImFjyIT7dJzRSKyRFuZ73YO8ZHow5mHgjZpx/gVnFL GVc+ahwbWMgaFRx+oIxRa/suDgNLZKr5ijW5apQGtjuKoxVSyvXnP4OQKt2Q0XjUzcWc 0Ayzm3rn9m5brKzAu+WyhXoPjS7aYB4fGpqWULnr9bQwA/m9dueNNC2Y3QIGzCw8hnwT fs5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=coxXcZkR2y5AZbXSv5WQymsQzrAZmI5iDjlOfIM7shY=; b=kjUSU6IrsbgXj2xIkN6IkMAvmsbl88Z+oNJIioSzTnHYETuf1cx3GUBe6EdXLmsj5s WemOLDEex/tcSXc3vXiGe31oCZHPAsuS//WIt34dzlrVilIppegM4S9jBtIKt+GFV95l VEtOqgK4iJBfjiXJ/0ueiL18qWAJ0++sMMLnnVC0qLceoOMgb3K+UqPwFptFpF6yu3G1 EJobDE4UXoUC3nKPhfIXwD9uiZPQ8FdTH2JXQEUab1vItHlpBlugYt9Z0t1RtvnGntBa 0o3bKYQcACSMBi/RPzIJKv+Eu7Anw8iqlY3Xr36YW5ANTrb/4joPjCibnuTk4Qvs9RF6 xh3A== X-Gm-Message-State: AOUpUlFjWbqlsAYasAYkRYQkQ6T5vOhmGjdk9QixYGcHh/qqxeWEsxQ9 tkiLU/VgT28Rj5gS6sR6oD/08mliC9nRd1xEMPOg0RgH X-Google-Smtp-Source: AA+uWPybVqB4/ImFUMyFYOwWDzrBFDCZxChjSgs3R02CA4w+J/BtQXKF+3sATfz5mmG3+ttmYwtEhwzyDrNL0prqNkg= X-Received: by 2002:a19:9710:: with SMTP id z16-v6mr21593562lfd.17.1534460645798; Thu, 16 Aug 2018 16:04:05 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:1f4c:0:0:0:0:0 with HTTP; Thu, 16 Aug 2018 16:04:05 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <201808161929.w7GJTWfS055411@pdx.rh.CN85.dnsmgr.net> References: <201808161929.w7GJTWfS055411@pdx.rh.CN85.dnsmgr.net> From: Marcelo Araujo Date: Fri, 17 Aug 2018 07:04:05 +0800 Message-ID: Subject: Re: svn commit: r337887 - head/usr.sbin/bhyve To: "Rodney W. Grimes" Cc: Warner Losh , John-Mark Gurney , 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 23:04:08 -0000 2018-08-17 3:29 GMT+08:00 Rodney W. Grimes : > > 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. > > lol, which is what the vendor that caused me grief with > ata serial numbers did decades ago. > > -- > Rod Grimes > rgrimes@freebsd.org > I have discussed a bit with imp@, but I will drop the patch here to get other peoples opinion too. So, name space and firmware number also need to be padded with spaces. I couldn't think in any other better way to do that. Does this patch looks reasonable? https://people.freebsd.org/~araujo/pci_nvme.diff Best, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)