From owner-svn-src-all@freebsd.org Sun Feb 19 18:40:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47A3ECE5CF9; Sun, 19 Feb 2017 18:40:59 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 08D8C1E6B; Sun, 19 Feb 2017 18:40:58 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id fWPmcUeaQsa1kfWPnchaGf; Sun, 19 Feb 2017 11:40:57 -0700 X-Authority-Analysis: v=2.2 cv=W+NIbVek c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=n2v9WMKugxEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=r4ZvWj_WVzq_KmOXN24A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B8B16508; Sun, 19 Feb 2017 10:40:54 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v1JIerbs037421; Sun, 19 Feb 2017 10:40:53 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201702191840.v1JIerbs037421@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r313943 - head/sbin/mdconfig In-Reply-To: Message from Edward Tomasz Napierala of "Sun, 19 Feb 2017 18:02:07 +0000." <20170219180207.GA6808@brick> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 19 Feb 2017 10:40:53 -0800 X-CMAE-Envelope: MS4wfIlAnacJbB9Fw+5LVLTLKq29bGtUJYU4dll5ppobnjKYreGU387pC92AiuiPqV78suCfFyKbgnpyM7hp3+giUV7X1f+hBFP/SAUZMQ6W3cDivM0X1S4C oklrrboVgOFRpXE9DgLQR65Bbf/CEbcNw287Q0OXNBoYvGPkNM79kydafOclw2Uvw/CNrvErGXv56inndy5YxZxPJc2D78WHd2VZ/44RtOsrSJ/QdjZnEGob vEoVdD1PfeB4S3fB57gYPQ== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Feb 2017 18:40:59 -0000 In message <20170219180207.GA6808@brick>, Edward Tomasz Napierala writes: > On 0219T0819, Cy Schubert wrote: > > In message <201702191608.v1JG8wAN068829@repo.freebsd.org>, Edward Tomasz > > Napier > > ala writes: > > > Author: trasz > > > Date: Sun Feb 19 16:08:58 2017 > > > New Revision: 313943 > > > URL: https://svnweb.freebsd.org/changeset/base/313943 > > > > > > Log: > > > Make mdconfig(8) not segfault when the kernel returns garbage data. > > > > > > MFC after: 2 weeks > > > Sponsored by: DARPA, AFRL > > > > > > Modified: > > > head/sbin/mdconfig/mdconfig.c > > > > > > Modified: head/sbin/mdconfig/mdconfig.c > > > ========================================================================= > ==== > > > = > > > --- head/sbin/mdconfig/mdconfig.c Sun Feb 19 14:53:59 2017 (r31394 > > > 2) > > > +++ head/sbin/mdconfig/mdconfig.c Sun Feb 19 16:08:58 2017 (r31394 > > > 3) > > > @@ -452,8 +452,8 @@ md_list(const char *units, int opt, cons > > > } > > > gc = &pp->lg_config; > > > type = geom_config_get(gc, "type"); > > > - if (strcmp(type, "vnode") == 0 || > > > - strcmp(type, "preload") == 0) { > > > + if (type != NULL && (strcmp(type, "vnode") == 0 || > > > + strcmp(type, "preload") == 0)) { > > > file = geom_config_get(gc, "file"); > > > if (fflag != NULL && > > > strcmp(fflag, file) != 0) > > > > > > > > > > I wonder why the kernel is returning garbage data? > > Because of a bug. I hadn't tracked that down yet, though, and while > kernel should be trusted, some additional error checking won't hurt. Agreed. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.