From nobody Sun May 19 06:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558101170; cv=none; d=zoho.com; s=zohoarc; b=Hb/8xJLsGnLqUSdeEWle281jobk3pxkmmGD/QtNzqXeZoN7dM0MLUCoS+JVoIeaqmhZPQIpLKKFaBRB7ZG7pyKgt4ZwJfTgXKLHVR23fA/adjllJZhTpCJg8iUwFKhnLVo7+4gSVv9lmcqJE1TlbcrSVyWeo9xL6w8uhIa5uUHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558101170; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=msJNBgoZq/+YSq3saeG7Lxgu3fqTumOEiWiUcHS5Sx8=; b=Qx2tPX+3EIZh4kd0IbPTYS1BswuHQlozoc2teiicdgJzmC4+WNvdFauuZPrbY+iNEi4RvjzHXzHWy9XzkstdUz9CHG5LA0eA2Q8pAPSCUXsqEGjd/Rb+Pk9jpuxiRm8wvm6JfjZYWZ5WILp4IFjwQwmQdDE4cPAcMJs6tGWs0d4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155810117006842.98078032873991; Fri, 17 May 2019 06:52:50 -0700 (PDT) Received: from localhost ([127.0.0.1]:49000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdHv-0003Kl-0n for importer@patchew.org; Fri, 17 May 2019 09:52:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdDU-0008St-8F for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRdDS-0003Xo-AH for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43022) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRdDQ-0003Vv-Im for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:06 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDC4DC0A4F49 for ; Fri, 17 May 2019 13:47:58 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91CB37A463; Fri, 17 May 2019 13:47:57 +0000 (UTC) From: Stefano Garzarella To: qemu-devel@nongnu.org Date: Fri, 17 May 2019 15:47:45 +0200 Message-Id: <20190517134748.340381-2-sgarzare@redhat.com> In-Reply-To: <20190517134748.340381-1-sgarzare@redhat.com> References: <20190517134748.340381-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 17 May 2019 13:47:58 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 1/4] net: fix assertion failure when ipv6-prefixlen is not a number X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" If 'ipv6-prefixlen' is not a number, the current behaviour produces an assertion failure: $ qemu-system-x86_64 -net user,ipv6-net=3Dfeca::0/a qemu-system-x86_64: qemu/util/qemu-option.c:1175: qemu_opts_foreach: Assertion `!errp || !*errp' failed. Aborted (core dumped) This patch fixes it, jumping to the end of the function when 'ipv6-prefixlen' is not a number, and printing the more friendly message: $ qemu-system-x86_64 -net user,ipv6-net=3Dfeca::0/a qemu-system-x86_64: Parameter 'ipv6-prefixlen' expects a number Signed-off-by: Stefano Garzarella Reviewed-by: Markus Armbruster --- net/net.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/net.c b/net/net.c index 2cf5e76469..555504a404 100644 --- a/net/net.c +++ b/net/net.c @@ -1135,11 +1135,11 @@ static int net_client_init(QemuOpts *opts, bool is_= netdev, Error **errp) =20 if (err) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "ipv6-prefix", "a number"); - } else { - qemu_opt_set_number(opts, "ipv6-prefixlen", len, - &error_abort); + "ipv6-prefixlen", "a number"); + goto out; } + + qemu_opt_set_number(opts, "ipv6-prefixlen", len, &error_ab= ort); } qemu_opt_unset(opts, "ipv6-net"); } @@ -1161,6 +1161,7 @@ static int net_client_init(QemuOpts *opts, bool is_ne= tdev, Error **errp) qapi_free_NetLegacy(object); } =20 +out: error_propagate(errp, err); visit_free(v); return ret; --=20 2.20.1 From nobody Sun May 19 06:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558101212; cv=none; d=zoho.com; s=zohoarc; b=ReM1wA+g7KMjYOtQW6ixnzaGlq4mSIK9Q9NhhrltN7pQwc41dIXcaN5cs9pvANIRVwOx/oUN85fF3dHlm/mwxgs3vlzWUngy8vIAWA1vAUq5MTF+sFtHDcIxRjJc0gSbde/wz5u/Jg8rtORQD6BmCBj9H9Da8PeBA4CiKKiy2vs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558101212; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Fmu1Np9kRVU6mZ8V6UB4TL+EBvMI+37y6Yp9n7xvT0M=; b=VcToPJ1kknBqbdqUcznjaQLAkB5W7ltRZ5vD4XrHU73y0xRtns8v7vm4HQ9aNi483SwVStwJkAB/SR8rKht/5ag6gsO5o+/582kqjCCNGSBbJlHYKFq9snzRpJuneb8r/ZGkCph5et5sJ+xbAJrjkeN74+xFXizRuYE7t5H1qEc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558101212372297.41840947459184; Fri, 17 May 2019 06:53:32 -0700 (PDT) Received: from localhost ([127.0.0.1]:49004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdIb-0003ob-CG for importer@patchew.org; Fri, 17 May 2019 09:53:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdDa-00006k-1U for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRdDW-0003bq-Ao for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50824) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRdDW-0003Uo-2Q for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:10 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5403A2EED1A for ; Fri, 17 May 2019 13:48:02 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22E8C5D9DC; Fri, 17 May 2019 13:47:58 +0000 (UTC) From: Stefano Garzarella To: qemu-devel@nongnu.org Date: Fri, 17 May 2019 15:47:46 +0200 Message-Id: <20190517134748.340381-3-sgarzare@redhat.com> In-Reply-To: <20190517134748.340381-1-sgarzare@redhat.com> References: <20190517134748.340381-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 17 May 2019 13:48:02 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 2/4] net: avoid using variable length array in net_client_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" net_client_init() uses a variable length array to store the prefix of 'ipv6-net' parameter (e.g. if ipv6-net=3Dfec0::0/64, the prefix is 'fec0::0'). This patch introduces g_strsplit() to split the 'ipv6-net' parameter, so we can remove the variable length array. Suggested-by: Markus Armbruster Signed-off-by: Stefano Garzarella Reviewed-by: Markus Armbruster --- v3: - fix indentation [Markus] - move substrings at the function level, and call g_strfreev(substrings) at the end of the function [Markus] --- net/net.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/net/net.c b/net/net.c index 555504a404..47c03e5843 100644 --- a/net/net.c +++ b/net/net.c @@ -1104,6 +1104,7 @@ static void show_netdevs(void) =20 static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp) { + gchar **substrings =3D NULL; void *object =3D NULL; Error *err =3D NULL; int ret =3D -1; @@ -1119,28 +1120,33 @@ static int net_client_init(QemuOpts *opts, bool is_= netdev, Error **errp) const char *ip6_net =3D qemu_opt_get(opts, "ipv6-net"); =20 if (ip6_net) { - char buf[strlen(ip6_net) + 1]; + char *prefix_addr; + unsigned long prefix_len =3D 64; /* Default 64bit prefix lengt= h. */ + + substrings =3D g_strsplit(ip6_net, "/", 2); + if (!substrings || !substrings[0]) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-net", + "a valid IPv6 prefix"); + goto out; + } =20 - if (get_str_sep(buf, sizeof(buf), &ip6_net, '/') < 0) { - /* Default 64bit prefix length. */ - qemu_opt_set(opts, "ipv6-prefix", ip6_net, &error_abort); - qemu_opt_set_number(opts, "ipv6-prefixlen", 64, &error_abo= rt); - } else { + prefix_addr =3D substrings[0]; + + if (substrings[1]) { /* User-specified prefix length. */ - unsigned long len; int err; =20 - qemu_opt_set(opts, "ipv6-prefix", buf, &error_abort); - err =3D qemu_strtoul(ip6_net, NULL, 10, &len); - + err =3D qemu_strtoul(substrings[1], NULL, 10, &prefix_len); if (err) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-prefixlen", "a number"); goto out; } - - qemu_opt_set_number(opts, "ipv6-prefixlen", len, &error_ab= ort); } + + qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); + qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len, + &error_abort); qemu_opt_unset(opts, "ipv6-net"); } } @@ -1163,6 +1169,7 @@ static int net_client_init(QemuOpts *opts, bool is_ne= tdev, Error **errp) =20 out: error_propagate(errp, err); + g_strfreev(substrings); visit_free(v); return ret; } --=20 2.20.1 From nobody Sun May 19 06:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558101047; cv=none; d=zoho.com; s=zohoarc; b=JLWkI/hiZMOPCU5lVfKdu+uBfYBaDTLmleWXM2qUyPBXE5p1K+k04HLVehJyWxVYJ5d9LPeUahm41dnrzD3Dzj0UhexDIU4sph0dcUYeTQeke5flBnsLacw32n4rdEfN9t/yRw0saFszbUG6UBc625b4XgzeJuiM0DFGS0vwPjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558101047; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=fjfQ7UQNh+mgY54jIPYKW+fXcD/6SRinX3y64qs4DoQ=; b=Eg1myONSLRGHJW0BngLN6W+3ToHT7W03bVLVOF9Cmoh9tRFsGrfdZTm/i3UsNDiaXQZU6avllZqinuqmIPIg+9Vhr3JbNiTfuBYnIb836XqhOtTqyoCHFbqXLil12RzhFWoAracF2HWKxZRss8Pru3p/JhbzUeS85xnwO28EhcM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155810104780871.38876338558453; Fri, 17 May 2019 06:50:47 -0700 (PDT) Received: from localhost ([127.0.0.1]:48945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdFu-0001H6-Tv for importer@patchew.org; Fri, 17 May 2019 09:50:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdDa-00006m-1m for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRdDW-0003bC-5X for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31664) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRdDU-0003Xu-6Q for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A38E30C1AF7 for ; Fri, 17 May 2019 13:48:06 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF4A25DD61; Fri, 17 May 2019 13:48:02 +0000 (UTC) From: Stefano Garzarella To: qemu-devel@nongnu.org Date: Fri, 17 May 2019 15:47:47 +0200 Message-Id: <20190517134748.340381-4-sgarzare@redhat.com> In-Reply-To: <20190517134748.340381-1-sgarzare@redhat.com> References: <20190517134748.340381-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 17 May 2019 13:48:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 3/4] net: use g_strsplit() for parsing host address and port X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Use the glib function to split host address and port in the parse_host_port() function. Suggested-by: Markus Armbruster Signed-off-by: Stefano Garzarella Reviewed-by: Markus Armbruster --- net/net.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/net/net.c b/net/net.c index 47c03e5843..23f29ef1d2 100644 --- a/net/net.c +++ b/net/net.c @@ -86,32 +86,39 @@ static int get_str_sep(char *buf, int buf_size, const c= har **pp, int sep) int parse_host_port(struct sockaddr_in *saddr, const char *str, Error **errp) { - char buf[512]; + gchar **substrings; struct hostent *he; - const char *p, *r; - int port; + const char *addr, *p, *r; + int port, ret =3D 0; =20 - p =3D str; - if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { + substrings =3D g_strsplit(str, ":", 2); + if (!substrings || !substrings[0] || !substrings[1]) { error_setg(errp, "host address '%s' doesn't contain ':' " "separating host from port", str); - return -1; + ret =3D -1; + goto out; } + + addr =3D substrings[0]; + p =3D substrings[1]; + saddr->sin_family =3D AF_INET; - if (buf[0] =3D=3D '\0') { + if (addr[0] =3D=3D '\0') { saddr->sin_addr.s_addr =3D 0; } else { - if (qemu_isdigit(buf[0])) { - if (!inet_aton(buf, &saddr->sin_addr)) { + if (qemu_isdigit(addr[0])) { + if (!inet_aton(addr, &saddr->sin_addr)) { error_setg(errp, "host address '%s' is not a valid " - "IPv4 address", buf); - return -1; + "IPv4 address", addr); + ret =3D -1; + goto out; } } else { - he =3D gethostbyname(buf); + he =3D gethostbyname(addr); if (he =3D=3D NULL) { - error_setg(errp, "can't resolve host address '%s'", buf); - return - 1; + error_setg(errp, "can't resolve host address '%s'", addr); + ret =3D -1; + goto out; } saddr->sin_addr =3D *(struct in_addr *)he->h_addr; } @@ -119,10 +126,14 @@ int parse_host_port(struct sockaddr_in *saddr, const = char *str, port =3D strtol(p, (char **)&r, 0); if (r =3D=3D p) { error_setg(errp, "port number '%s' is invalid", p); - return -1; + ret =3D -1; + goto out; } saddr->sin_port =3D htons(port); - return 0; + +out: + g_strfreev(substrings); + return ret; } =20 char *qemu_mac_strdup_printf(const uint8_t *macaddr) --=20 2.20.1 From nobody Sun May 19 06:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558101204; cv=none; d=zoho.com; s=zohoarc; b=QAWfNr+9KottL+1eTwUxu6sETBAcSAZAtd+hrT2k3wAAx1siUwTNaj02Ev94/Pp2CO8Yl+pPHSfG1l2SNaliYAkVxDvJOe4az5Ojo7GBQ4EOsGFYBYpBuzUmOWNsYQ87cNuNyHn6UwaXMPdYtz2RKNbzTzOD3pqWXh9IgkfJlqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558101204; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=uL1LmYqDjkigHrYJe1PYGg8CiIaeUPLbCtCMyxNxDQ8=; b=Ms/O4KJuoe5EILgIU6ism8Gd3lvtSI8uH858RkG5Jztv1wZGmucmsqNyLmXX+8hRTnWPW7t2a7s8D1Ann1sASf2EKxJn7FWwI7jpbxnuXOANGPxLZIFMs6b+76rPB6Mn1LeuqhCCOR3xRP6Q28x7DSxJdQEAgh/vKMPLN8sv5qo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155810120467642.512054300391355; Fri, 17 May 2019 06:53:24 -0700 (PDT) Received: from localhost ([127.0.0.1]:49002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdIU-0003j6-J6 for importer@patchew.org; Fri, 17 May 2019 09:53:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdDa-00006l-1o for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRdDW-0003bT-98 for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53198) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRdDW-0003ZH-3b for qemu-devel@nongnu.org; Fri, 17 May 2019 09:48:10 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D500A75724 for ; Fri, 17 May 2019 13:48:07 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 953B35DA64; Fri, 17 May 2019 13:48:06 +0000 (UTC) From: Stefano Garzarella To: qemu-devel@nongnu.org Date: Fri, 17 May 2019 15:47:48 +0200 Message-Id: <20190517134748.340381-5-sgarzare@redhat.com> In-Reply-To: <20190517134748.340381-1-sgarzare@redhat.com> References: <20190517134748.340381-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 17 May 2019 13:48:07 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 4/4] net: remove unused get_str_sep() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Since the get_str_sep() function is no longer used in net/net.c, we can remove it. Signed-off-by: Stefano Garzarella Reviewed-by: Markus Armbruster --- net/net.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/net/net.c b/net/net.c index 23f29ef1d2..4e1b25ba91 100644 --- a/net/net.c +++ b/net/net.c @@ -63,26 +63,6 @@ static QTAILQ_HEAD(, NetClientState) net_clients; /***********************************************************/ /* network device redirectors */ =20 -static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) -{ - const char *p, *p1; - int len; - p =3D *pp; - p1 =3D strchr(p, sep); - if (!p1) - return -1; - len =3D p1 - p; - p1++; - if (buf_size > 0) { - if (len > buf_size - 1) - len =3D buf_size - 1; - memcpy(buf, p, len); - buf[len] =3D '\0'; - } - *pp =3D p1; - return 0; -} - int parse_host_port(struct sockaddr_in *saddr, const char *str, Error **errp) { --=20 2.20.1