From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0741EC169C4 for ; Sun, 3 Feb 2019 13:04:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0252218F0 for ; Sun, 3 Feb 2019 13:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549199068; bh=eirHXy320cte9yx15QjSE5Et+ixAyocLsv+sO+Nai5c=; h=Subject:To:From:Date:List-ID:From; b=k/gkcMlf5/PZ9k5lDfTKuGAlPCkczstvcXKPvSyyzm+zM0vMft++EOmHyqQrJ/x30 qXGVZbWqdG+ddH6+DS7S0svDzfmTDDLqGlxAftOnetQ0XYV+VfpLNC2P/72kiqs3vL a+RE6RFgsFNy+h5zoSWP3DAXu0eHAis7wKBQpsWk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727762AbfBCNE2 (ORCPT ); Sun, 3 Feb 2019 08:04:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:41056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726625AbfBCNE2 (ORCPT ); Sun, 3 Feb 2019 08:04:28 -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 EB2E620815; Sun, 3 Feb 2019 13:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549199067; bh=eirHXy320cte9yx15QjSE5Et+ixAyocLsv+sO+Nai5c=; h=Subject:To:From:Date:From; b=RiHxkPVjhoFHfDqorUv0MHRuPINJja3G8mRqK5baWKD42bwJ1MoJAmJ31ztHavm27 beVjxEI7oMkEk8mFYfJEXJKoLqsEP46qB58fccNe3CmckrO6bG/9ziBRKfA1Abmjaq 11EksMCCEeIfQZnCtTm3n3bQg3I/abP7GgJG6aj8= Subject: patch "tools: iio: iio_generic_buffer: make num_loops signed" added to staging-linus To: mkelly@xevo.com, Jonathan.Cameron@huawei.com, Stable@vger.kernel.org, dan.carpenter@oracle.com From: Date: Sun, 03 Feb 2019 14:04:12 +0100 Message-ID: <1549199052129130@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled tools: iio: iio_generic_buffer: make num_loops signed to my staging git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git in the staging-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From b119d3bc328e7a9574861ebe0c2110e2776c2de1 Mon Sep 17 00:00:00 2001 From: Martin Kelly Date: Fri, 11 Jan 2019 23:13:09 +0000 Subject: tools: iio: iio_generic_buffer: make num_loops signed 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 --- tools/iio/iio_generic_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index 3040830d7797..84545666a09c 100644 --- 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; -- 2.20.1