From nobody Wed Nov 19 08:19:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615314476; cv=none; d=zohomail.com; s=zohoarc; b=WkSKaMRuIfrdGj4AP3IJBewvrbDoHtuXZiwlEI0c4f+5tmX5lbDdnH1bmH8/4Bz/RDtr42BfZn5l2NySaHY2TUf0SWJkiD7hrgBRmEAtyL4FBtH6WdhpdlbehjEl9K1jmmn30IKmtRDMQeq/T0hjk/KlAHLlaIouttMV2nM1VJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615314476; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=pz2LHGBFo7rdr0OLuP12qCzCTyCC4J17mZdA7YWW5O8=; b=XNLK2zufOAJFa7bLjLsZqALxCOjHqzfLhXJzZ9zapSct5CXrvgfVMgmCJoB4NdSeklKRvCZkI2qe6c6YKqIO3yHok7wpUnngqS64S8evbN4Clv61YG/bEz9bWXSgfu0HkJftbOyt7pXucc/HlPTaWD9hkTxoE3RfM7njcYh2ijY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1615314476900288.4257140232751; Tue, 9 Mar 2021 10:27:56 -0800 (PST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-84-4Y6jWMEIPAOSDNNtpUuWug-1; Tue, 09 Mar 2021 13:27:51 -0500 Received: by mail-ed1-f69.google.com with SMTP id h5so7199121edf.17 for ; Tue, 09 Mar 2021 10:27:51 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id eo22sm8984049ejc.0.2021.03.09.10.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 10:27:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615314474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pz2LHGBFo7rdr0OLuP12qCzCTyCC4J17mZdA7YWW5O8=; b=M/Rwx/neptKsP5nCATG1UJmbdn2rMYIxJrabFrpnLb2Dlbw8FX8TmItIcldXvXkEU/LEyM pByRnvd786kv4J7Qv+tI7X9pSg2he8RKSfYjpy+ELds5fJtQGy5YHm1vx6Fn7FqRZugUmu kin6P1opxObwl/Du5mSrh5LdoCA8elo= X-MC-Unique: 4Y6jWMEIPAOSDNNtpUuWug-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pz2LHGBFo7rdr0OLuP12qCzCTyCC4J17mZdA7YWW5O8=; b=cTL9plce2vzRKaZx+u3zPpEjkcWJkz9BJq+RU8HqKoAxS4o5V8k1pt5TmNi50da9fK e1+/GWdPu1DXnYdoSr0MnKTuTYRRbBSEgxwDZ7Sw8jIw37Qp0T9qNonE30lfAyV9dEZi AO2qOKZcPY65kumeOaI1FVWX36RuKzV3/9GNiiylLYsxy8DAo7P/4s/qxsSpcEmd3gcY tYdwe1b2dr3wenFILM7B77jmQJYDDnDRq0zZRqOum1u67YzwSOLJp+wsruESJCgICNKO g2Yn6dkavdc5cwGTIbMiBwyHjTrJymXQv/zefX4Fp+jXxIBHeBNGKeqSFtKZp8DTkO64 WVsQ== X-Gm-Message-State: AOAM5303QgxnYW5BOmS2BqPWn48R+vq1gxNmYjyYCiodN3Q0jsrCtA0U 6GtHkUqVn+J5vM6ssXqMVxgb/UXLcDZjLCsPgGEiFkmjfmhyEm0JqdM1WIEMqh28OfqrlEOsfGd +gfRDO+CsAn/irg== X-Received: by 2002:a17:906:a896:: with SMTP id ha22mr21606516ejb.503.1615314470233; Tue, 09 Mar 2021 10:27:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyL8ZBx3d5KC/PlT963GamrJPASs8TsG67PMKppdoM+EDRqttqbd2XfBTD0nhHu9UJiKgB42g== X-Received: by 2002:a17:906:a896:: with SMTP id ha22mr21606503ejb.503.1615314470087; Tue, 09 Mar 2021 10:27:50 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Laurent Vivier , Dmitry Fleytman , Miroslav Rezanina , Li Qiang , Paolo Bonzini , Jason Wang , Thomas Huth , Alexander Bulekov , Stefano Garzarella , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 6/6] net/eth: Return earlier in _eth_get_rss_ex_dst_addr() Date: Tue, 9 Mar 2021 19:27:09 +0100 Message-Id: <20210309182709.810955-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210309182709.810955-1-philmd@redhat.com> References: <20210309182709.810955-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Slightly simplify _eth_get_rss_ex_dst_addr() by returning earlier. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- net/eth.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/net/eth.c b/net/eth.c index e984edcfb0b..b44439d31c5 100644 --- a/net/eth.c +++ b/net/eth.c @@ -407,23 +407,21 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int= pkt_frags, { size_t input_size =3D iov_size(pkt, pkt_frags); struct ip6_ext_hdr_routing *rthdr; + size_t bytes_read; =20 if (input_size < ext_hdr_offset + sizeof(*rthdr)) { return false; } rthdr =3D (struct ip6_ext_hdr_routing *) ext_hdr; =20 - if ((rthdr->rtype =3D=3D 2) && (rthdr->segleft =3D=3D 1)) { - size_t bytes_read; - - bytes_read =3D iov_to_buf(pkt, pkt_frags, - ext_hdr_offset + sizeof(*ext_hdr), - dst_addr, sizeof(*dst_addr)); - - return bytes_read =3D=3D sizeof(*dst_addr); + if ((rthdr->rtype !=3D 2) || (rthdr->segleft !=3D 1)) { + return false; } =20 - return false; + bytes_read =3D iov_to_buf(pkt, pkt_frags, ext_hdr_offset + sizeof(*ext= _hdr), + dst_addr, sizeof(*dst_addr)); + + return bytes_read =3D=3D sizeof(*dst_addr); } =20 static bool --=20 2.26.2