Received: by 10.213.65.68 with SMTP id h4csp495206imn; Fri, 16 Mar 2018 09:28:11 -0700 (PDT) X-Google-Smtp-Source: AG47ELv+sjrrKZRoPDoRFhIwJOybQfq+zVZvxlO94yqPBnrCtYhWCHgLKMW8gvzcvrwy2uZkjzw9 X-Received: by 10.99.185.7 with SMTP id z7mr1972367pge.123.1521217691218; Fri, 16 Mar 2018 09:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521217691; cv=none; d=google.com; s=arc-20160816; b=oPoAuQhbB81PoPAKYiM8y2+7Iyyyp9ItW7PZZ7ydQZ4yLs9Eba928/f/zL4M6kfBDx AKjBfPle7P2AQk69z9xzUBdSgD86PlKj7o9P3nAvLw4qYsr9gXLfhLw6WhwI5hqBjNgL eshhUTOrB8XQrhZCC2mfrJ87frhr+FYjx46yZNPGEzsNVEMShDlV1XW7y/bDkMwx6Ekd t8g1XJIDhymQxw+/eKuM3yVjsKYs1qMW225QUiWhGVyM9cpIPU4H1yBCScbS0wPtqGO9 H1obta6+eKdgcAlOqb2lc22Zjoc7o5mqv9rXzQ9KA/hNVlbuyXfo1FLPlTSHErghgqz1 gqOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=vaqw5UURa9hyr03f3g0V1jPvGeKOzS7WXhgKULBstIk=; b=kU1SdxXc+TWCBxH0ReEh2andthlFkaikGoQI5+HzEluzP4fyHxmDQzAgFMqHtvq2km F5vaEblwUMYAjU37jsYAKB/e3fOVRNeTdOFtmdpqSoCXAVbXffyvN9JgaRr2UJ7SytKy 2FIoQSuMlamaxZQvb4bM296grlP1Lz2aZPKWAL6Yy4ezSplMz2Xrcle/6q60OVtnA7da 9HcCV9dlPg+wKTKzUuL0FRJnvwnxDBHc8vqJfodKUizCd9NNYRXa/14nzA1BR1Us952w Z8/ksAWcKeKHncAyGbwb71e6B4pjptoUo85NBQ4PsrbYhgb0SVpVTXGsZWr/xFJytpz+ ZXXQ== 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 q87si5713456pfa.385.2018.03.16.09.27.56; Fri, 16 Mar 2018 09:28:11 -0700 (PDT) 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 S934250AbeCPPj3 (ORCPT + 99 others); Fri, 16 Mar 2018 11:39:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43250 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754613AbeCPPj0 (ORCPT ); Fri, 16 Mar 2018 11:39:26 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C53B8CD9; Fri, 16 Mar 2018 15:39:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Mori Hess , Ian Abbott Subject: [PATCH 4.15 012/128] staging: comedi: fix comedi_nsamples_left. Date: Fri, 16 Mar 2018 16:22:33 +0100 Message-Id: <20180316152336.881831240@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Frank Mori Hess commit a42ae5905140c324362fe5036ae1dbb16e4d359c upstream. A rounding error was causing comedi_nsamples_left to return the wrong value when nsamples was not a multiple of the scan length. Cc: # v4.4+ Signed-off-by: Frank Mori Hess Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -484,8 +484,7 @@ unsigned int comedi_nsamples_left(struct struct comedi_cmd *cmd = &async->cmd; if (cmd->stop_src == TRIG_COUNT) { - unsigned int nscans = nsamples / cmd->scan_end_arg; - unsigned int scans_left = __comedi_nscans_left(s, nscans); + unsigned int scans_left = __comedi_nscans_left(s, cmd->stop_arg); unsigned int scan_pos = comedi_bytes_to_samples(s, async->scan_progress); unsigned long long samples_left = 0;