From owner-svn-src-head@freebsd.org Wed Jun 27 04:11:18 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 513D2102CF61; Wed, 27 Jun 2018 04:11:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA5B59253B; Wed, 27 Jun 2018 04:11:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10FF21DE92; Wed, 27 Jun 2018 04:11:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5R4BE34079049; Wed, 27 Jun 2018 04:11:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5R4BECJ079048; Wed, 27 Jun 2018 04:11:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201806270411.w5R4BECJ079048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 27 Jun 2018 04:11:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335691 - head/sys/dev/pccard X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/pccard X-SVN-Commit-Revision: 335691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 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: Wed, 27 Jun 2018 04:11:18 -0000 Author: imp Date: Wed Jun 27 04:11:14 2018 New Revision: 335691 URL: https://svnweb.freebsd.org/changeset/base/335691 Log: pccard: recode to use devctl_safe_quote_sb instead of devctl_safe_quote. Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D16026 Modified: head/sys/dev/pccard/pccard.c Modified: head/sys/dev/pccard/pccard.c ============================================================================== --- head/sys/dev/pccard/pccard.c Wed Jun 27 04:11:09 2018 (r335690) +++ head/sys/dev/pccard/pccard.c Wed Jun 27 04:11:14 2018 (r335691) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1036,13 +1037,18 @@ pccard_child_pnpinfo_str(device_t bus, device_t child, struct pccard_ivar *devi = PCCARD_IVAR(child); struct pccard_function *pf = devi->pf; struct pccard_softc *sc = PCCARD_SOFTC(bus); - char cis0[128], cis1[128]; + struct sbuf sb; - devctl_safe_quote(cis0, sc->card.cis1_info[0], sizeof(cis0)); - devctl_safe_quote(cis1, sc->card.cis1_info[1], sizeof(cis1)); - snprintf(buf, buflen, "manufacturer=0x%04x product=0x%04x " - "cisvendor=\"%s\" cisproduct=\"%s\" function_type=%d", - sc->card.manufacturer, sc->card.product, cis0, cis1, pf->function); + sbuf_new(&sb, buf, buflen, SBUF_FIXEDLEN | SBUF_INCLUDENUL); + sbuf_printf(&sb, "manufacturer=0x%04x product=0x%04x " + "cisvendor=\"", sc->card.manufacturer, sc->card.product); + devctl_safe_quote_sb(&sb, sc->card.cis1_info[0]); + sbuf_printf(&sb, "\" cisproduct=\""); + devctl_safe_quote_sb(&sb, sc->card.cis1_info[1]); + sbuf_printf(&sb, "\" function_type=%d", pf->function); + sbuf_finish(&sb); + sbuf_delete(&sb); + return (0); }