Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp712100imj; Wed, 13 Feb 2019 16:17:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IYgfjaf28Y2YKvF1x28mIdnXpzex5axY+jmMlTSv/DDX2GkiYxysT/R3eEXNQATSk4jhMDC X-Received: by 2002:a63:2f47:: with SMTP id v68mr906656pgv.144.1550103472075; Wed, 13 Feb 2019 16:17:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550103472; cv=none; d=google.com; s=arc-20160816; b=kQoqHat6MKGBqXvopiqQKnPCKgutwMlZMcpc2ooybYS8pRZOv2e0Thfb3X+CHo1751 WsFcJygTcM0J3b24whyUienFPcSKo7Ghz7wrMG1ZDF2+rpJuj2k5fygTG24uziK4oyeM HZX0/63vS7SSRRopAoe/JSrNYNSgp9DL/Y9aPnYe/7aUNVx+vhyfVFxjkILvF4YTHocL apfSslYy+1HGJfExZyGbqdl+S/VCS9cnnxnakPCe/loc7tS0dUCotEmEOQbH2K8YdShp eBYst51G6HQheCNRGCTHsT0tautZwpF7nRxlZmRoDy2jABTnPMWB1nem4sDiBsdMa5GH pqUQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NwUPxQDeZVbcA66Qe7AXpb+trAq+Zt3+5wz67CWRYoQ=; b=lgliBqLmppnVddnNsC96POzOF3J6KimNDoCJrEZ49v8ODIndca3HNh+Dqa9umIRMnK Q4LH6ObyNzvs4y+LRz9/fB6aaUktcFwQWhBKfIE6IN05ykK7377Yr3cEKvztsRX0Cmp1 fbUAfBpV4+V0qBcxDXmC2Aj9Qw+ldp2wwAKuUwdvC3DBlo1+vGYneab1aJTUnlmSyfSX 0tEEMEHlZeZMWm65jTZEuDrb17x4HtGBlmjhAQdG24iQv5EJAAosOyZ/46/k4iFGeYtD gdAf7+goK6A7HJDIgVDH5rbslLxI1WZwNK1+b52V5vKJmu3AtUumte3m4c5OOOpd2zoi iKqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UfrKf9AS; 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 u17si797767pfi.7.2019.02.13.16.17.36; Wed, 13 Feb 2019 16:17:52 -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; dkim=pass header.i=@kernel.org header.s=default header.b=UfrKf9AS; 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 S1732420AbfBMSpP (ORCPT + 99 others); Wed, 13 Feb 2019 13:45:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:43896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406190AbfBMSpM (ORCPT ); Wed, 13 Feb 2019 13:45:12 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC5BA222D1; Wed, 13 Feb 2019 18:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083512; bh=g836qVs7FTSdQ1eq7h7ZiBcmUbHhJ5EFABGN1lOZ/EA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfrKf9ASGGB+EfxER0jNaNkJhkWBJUgH9bx3oLs7aMadBXW8AR4Nr4fmRH5UQbFAP v41U5R8GvqC8dHabqSkzo9YImnQa3owyfj2qpo3LwG0FyvX8Ozu31tuCrxifj0yw8O 7qY4obBFDqaehPkE5Lr0jb+X2tM+QsMOG7w0JZr0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Kelly , Dan Carpenter , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 4.20 06/50] tools: iio: iio_generic_buffer: make num_loops signed Date: Wed, 13 Feb 2019 19:38:11 +0100 Message-Id: <20190213183656.291941329@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183655.747168774@linuxfoundation.org> References: <20190213183655.747168774@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Kelly commit b119d3bc328e7a9574861ebe0c2110e2776c2de1 upstream. Currently, num_loops is unsigned, but it's set by strtoll, which returns a (signed) long long int. This could lead to overflow, and it also makes the check "num_loops < 0" always be false, since num_loops is unsigned. Setting num_loops to -1 to loop forever is almost working because num_loops is getting set to a very high number, but it's technically still incorrect. Fix this issue by making num_loops signed. This also fixes an error found by Smatch. Signed-off-by: Martin Kelly Reported-by: Dan Carpenter Fixes: 55dda0abcf9d ("tools: iio: iio_generic_buffer: allow continuous looping") Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- tools/iio/iio_generic_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/iio/iio_generic_buffer.c +++ b/tools/iio/iio_generic_buffer.c @@ -330,7 +330,7 @@ static const struct option longopts[] = int main(int argc, char **argv) { - unsigned long long num_loops = 2; + long long num_loops = 2; unsigned long timedelay = 1000000; unsigned long buf_len = 128;