Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1183497lqo; Sat, 11 May 2024 10:53:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUE/a84zSKwHv1OGxTBf/KQbpJHJvr5i+7llBw7C5IOxQfSY+xdR85xXXATvu0ybqJn9Ihb9rU7QyVqCOyszw30xBIPUWG/xCOzVoUZ+g== X-Google-Smtp-Source: AGHT+IHgUP0Wt/EkkcbwPT2OIGjgfYqzQyYbS/l3h2E1TgUVzw/kc8C1kBF8r0UrCmJVHF6QV0Op X-Received: by 2002:a05:620a:200d:b0:792:9b08:e36 with SMTP id af79cd13be357-792c75ac168mr613091585a.44.1715450028592; Sat, 11 May 2024 10:53:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715450028; cv=pass; d=google.com; s=arc-20160816; b=MEr3krPM1NqVtblYSY79GVllriIT/1a9SRdn7pCpJlytXij4oSzD0vOeW4oHT5ptSH zMvFoGN9zkFGfIi+Ogc3xL1IOtccvMOQiV8LIPGpBrwOUBcG85TwRri8EZ/ugv8uZbDz GWGzS/FdfDbALUzcB6TINHgJb+qpwLfaFXhJT3MI3i0CK8l+2Wd2P6FC/yn5McxMUPjs E0tN8GCRR49Kpe8yvvuEGlpSDZQQFinOId0zBDq6HjfbZXTUraekGE4BYJdnncZ9sS1+ SuxWLaB8p+k7VHR5FLQ04/enjuafrGd9XVcLomcRdCu7fFWJAFi+UaKtzP4C57J796a8 p2jA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dUcvSKD1wu+xRDPWvX3IO0iKBvSPfPFAszLAWAC0VFg=; fh=RE8/XQO2cmYJzAhlkqDc5E2Z5fdNv+RwVOkkyZafQFs=; b=PhHy3kG1+assFLZr4OhYLAa06ZfiJa1EM2TuUSjH5u/pkTPKLPeVBanmax0GQuRIZH e6IQkMZvw513cNbNDAobkkZ7wamlKX3Pw1x0m+iomnLNBA43psdHQFojyE5/8JsX8V5/ zH7s5N/sRc+yMzzKia2WLPHKhLq03sh1emUqhosQAY4vMk+hndWMrAoYJX8AWhkvCdWz 2QlGLl7F86uDaMCRLvP+8Ky9CO+5BQbjzCnGZxvmhzouP2QfuKkslfUjPfPKsGkrGwYV PguoLsTqMzAb/X39nBwKLQwwgE3d58o5L3rnF0csSoHTIFsEziD+dbUMnsEzvEaZoWn1 9wuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bg3OttkP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176673-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf30a91asi599778585a.359.2024.05.11.10.53.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 10:53:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bg3OttkP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176673-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 527ED1C20D6A for ; Sat, 11 May 2024 17:53:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42E161CAB3; Sat, 11 May 2024 17:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Bg3OttkP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FE6E17588; Sat, 11 May 2024 17:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715450014; cv=none; b=YlkWYI/ZRhlFB+kWLC5DV9/VAhB5ORKwhmdpIpFRzSf7Bzj2H8PsCmJ+T6LxKYoteeNk1jpoksUcRMQGtEGFxIUqJSX31H5zBw/bcjDF0X2rzGWdpS0Qd2jZ7EfDbO5pT+3dy4XIXOhU31jFCHdJzygsORyD51yzUTjEBZzaXI4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715450014; c=relaxed/simple; bh=35okiB1iB8bZt1zztcxMY+1mWKZVmAt1sMm6fXCVHRU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LbuTypLY98lsWNkT922arSd6Gdzn4MXx5gif3Nu4GP9ZCbOJ02cQrWl1xr7g0DXVAWfxwBKqkzWLFZBlhBf5KB+jbAVPuKooqCwp+Pwl0zQPLfTyXpHR+bxbZrCCexJ2q4R0JFrkIm7PQAytS2yVxbxM+dKb0OyMsEKjIBpeub0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bg3OttkP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A705AC2BBFC; Sat, 11 May 2024 17:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715450013; bh=35okiB1iB8bZt1zztcxMY+1mWKZVmAt1sMm6fXCVHRU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Bg3OttkPGY5388kU5cRBN8zJrPnSYv4QnuR6ArCOC6Jb6bvj4UifjggL8mJqDD+mC xUuHqSxQXamYha0GlLqw3n5k1ACfUbwMAdYTeUFN4wco5/TMaUzz2mtTv99riFSCKk IB98jI7lWiGOOaIRJRyEXS1LinqUwneHHdTux7DByvW03ZXCCZMwuiwRHXA0BY9bAE q1Xyk9t7ljOy+JgV5jxzDiK2WXIKboS1ny7SFNCF4iTtj3tEXq4NwpylMtzgncG/6T KpKTVSqsR9ASfYguvWPbJGKK3t1jvDA5ZOMgKsq48MMj2fH1BOn9dhTaHSmg7UeZ81 LYKiaU3BoX3wA== Date: Sat, 11 May 2024 18:53:27 +0100 From: Simon Horman To: Dan Carpenter Cc: Xuan Zhuo , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH net-next] virtio_net: Fix error code in __virtnet_get_hw_stats() Message-ID: <20240511175327.GT2347895@kernel.org> References: <3762ac53-5911-4792-b277-1f1ead2e90a3@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3762ac53-5911-4792-b277-1f1ead2e90a3@moroto.mountain> On Fri, May 10, 2024 at 03:50:45PM +0300, Dan Carpenter wrote: > The virtnet_send_command_reply() function returns true on success or > false on failure. The "ok" variable is true/false depending on whether > it succeeds or not. It's up to the caller to translate the true/false > into -EINVAL on failure or zero for success. > > The bug is that __virtnet_get_hw_stats() returns false for both > errors and success. It's not a bug, but it is confusing that the caller > virtnet_get_hw_stats() uses an "ok" variable to store negative error > codes. > > Fix the bug and clean things up so that it's clear that > __virtnet_get_hw_stats() returns zero on success or negative error codes > on failure. > > Fixes: 941168f8b40e ("virtio_net: support device stats") > Signed-off-by: Dan Carpenter Hi Dan, all, Strictly this is doing two things. But I agree that the "ok" variable in virtnet_get_hw_stats() was very confusing, and I'm not sure how long it would have taken me to grasp the fix without that change being here too. Reviewed-by: Simon Horman