Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp175786imj; Fri, 15 Feb 2019 21:00:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IaX7/j6zuGpYeqaQVnsPxznwjshrO7QrhrZym2HIC8D/GkJFWPgSlp68BYj7w9KX6Vheowq X-Received: by 2002:a17:902:8504:: with SMTP id bj4mr13454609plb.200.1550293229530; Fri, 15 Feb 2019 21:00:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550293229; cv=none; d=google.com; s=arc-20160816; b=UmQrJXJaZ3VN8b06xS2i1vusnIKn+8t0Z+2edXet4zxFyLbM8GDPupwyS3S+3+rNo2 5j3nH5uMkZRgXfyjeoXS0p343vaAcCmCOCZF8uJ8uDEvmLwr6V4Hw1HRRuF/Br4d9Uxb d5eRnprBbz6FjaQv+CmlYxWm/n4BHLQtFZ0USJZTuGhHvsHCREkyPspErJCEm+tbrCPJ fvibw/NTmnqqHNzQpKN08e0ssAwbO9gWtPGWRjKZCQKjv1zuxFwmWEPYFpmTZMWErHwF 4GRRaAjN5tclfrXWSwmr44v1OY4ZY5Xscw/ZHi2nAhgUZPhTvfmD3epSc8pNyZDH7PZZ 0Jnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=Rl1rJRRBfXDJX6UdMKTLIsLRTJ1GwA4jVkwP+okHqPM=; b=wcfWrQx5TF2MjVBssgZnZUzsLWmkQNNdlvsUFhvxYOKyd57y8jcuvKIv6ipkZeNctP AdzR/NrDJ0nkF4bkykkTqJ1B3LBg4yhQzVzQHQPfhGZ+22eHajqXoqJJclnQjs9zbZES yE7LUo3A2sm6laVJB103dnuerN96wpLIjsjqqYnFGLHAmdW195u5ob6xPcrYnFNLS6xA 28Cp+jL25MggSHAXTM9J34y4bO0zu9oVG90Gpi+suM+GQA1Mx5+LLXpKoKGxmoe/rZVV 8Y0G15jvayv0H6vOP38m0e7Opqw2ydLOcQHr1UwfnZ/rlS39ZmF969peO/ckAisW3Nh3 2H1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck6si9078904plb.298.2019.02.15.21.00.14; Fri, 15 Feb 2019 21:00:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730994AbfBOSEA (ORCPT + 99 others); Fri, 15 Feb 2019 13:04:00 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:43488 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbfBOSEA (ORCPT ); Fri, 15 Feb 2019 13:04:00 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 60CE214F05442; Fri, 15 Feb 2019 10:03:59 -0800 (PST) Date: Fri, 15 Feb 2019 10:03:56 -0800 (PST) Message-Id: <20190215.100356.251698752340585300.davem@davemloft.net> To: jasowang@redhat.com Cc: mst@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stephen@networkplumber.org Subject: Re: [PATCH net] vhost: correctly check the return value of translate_desc() in log_used() From: David Miller In-Reply-To: <20190215075324.18891-1-jasowang@redhat.com> References: <20190215075324.18891-1-jasowang@redhat.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 15 Feb 2019 10:03:59 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Wang Date: Fri, 15 Feb 2019 15:53:24 +0800 > When fail, translate_desc() returns negative value, otherwise the > number of iovs. So we should fail when the return value is negative > instead of a blindly check against zero. > > Reported-by: Stephen Hemminger > Fixes: cc5e71075947 ("vhost: log dirty page correctly") > Signed-off-by: Jason Wang Jason, please put the Fixes tag first. Thank you.