From nobody Mon Feb 9 11:29:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1575559404; cv=none; d=zohomail.com; s=zohoarc; b=FxewqVshxwXpGtxERpUfd+31RInlCIKDF72CDzsPCvDKO9507SHyqsUVld43TMC9GzIq32+zw9a0FNDIbjD74OeRUSfQWQTRk4mW+miG5p9gUp0EGvI05mOOQZhqvH2oFI//A876Q1XvcHEZBLyO+ne/2/X+F6oz7bmfV5TtVhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575559404; h=Content-Type: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; bh=h4hjw4bdGdtnQKWCJz0gjk3k2W2DnZFDjPJHwWtTuTA=; b=mW/BI6eJFuti9CTG/hKxabhqTH/KufNwqadPtY8hepEN2xTWDeXNVyaxHejIkRYJjBCSSqYlt9DQnTUf8N/P4qudSEATx8f3/pL66FDDMX4+lLYfi7KFaC0bBBoKXHb210g2yZ98hjzIZp8kirXwjZIQ88bt00Sk0Jb4aJ3hIhs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.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 1575559404168878.5370614931105; Thu, 5 Dec 2019 07:23:24 -0800 (PST) Received: from localhost ([::1]:56186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icsyP-0002C0-Vq for importer@patchew.org; Thu, 05 Dec 2019 10:23:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48610) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icsvx-0000BG-IK for qemu-devel@nongnu.org; Thu, 05 Dec 2019 10:20:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icsvt-0005ke-3l for qemu-devel@nongnu.org; Thu, 05 Dec 2019 10:20:46 -0500 Received: from relay.sw.ru ([185.231.240.75]:43530) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icsvq-0005a7-RW for qemu-devel@nongnu.org; Thu, 05 Dec 2019 10:20:43 -0500 Received: from vovaso.qa.sw.ru ([10.94.3.0] helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1icsvZ-00007O-JS; Thu, 05 Dec 2019 18:20:25 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Subject: [PATCH v7 02/21] net/net: Clean up variable shadowing in net_client_init() Date: Thu, 5 Dec 2019 18:20:00 +0300 Message-Id: <20191205152019.8454-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191205152019.8454-1-vsementsov@virtuozzo.com> References: <20191205152019.8454-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jason Wang , vsementsov@virtuozzo.com, armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Variable int err in inner scope shadows Error *err in outer scope. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- net/net.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/net/net.c b/net/net.c index 84aa6d8d00..9e93c3f8a1 100644 --- a/net/net.c +++ b/net/net.c @@ -1126,16 +1126,13 @@ static int net_client_init(QemuOpts *opts, bool is_= netdev, Error **errp) =20 prefix_addr =3D substrings[0]; =20 - if (substrings[1]) { - /* User-specified prefix length. */ - int err; - - 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; - } + /* Handle user-specified prefix length. */ + if (substrings[1] && + qemu_strtoul(substrings[1], NULL, 10, &prefix_len)) + { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "ipv6-prefixlen", "a number"); + goto out; } =20 qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); --=20 2.21.0