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=-11.8 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_HELO_NONE,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 72701C31E40 for ; Mon, 12 Aug 2019 14:48:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39B8C2085A for ; Mon, 12 Aug 2019 14:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565621314; bh=nSx2VtkkIFSCQ9VzHGXwUxoMmn9vUIkc8WGbPO6iN2k=; h=Subject:To:From:Date:List-ID:From; b=2KDHxfXHC1x1RyvQvmvgcG1jiqwZr1NmpgAN0YLMF5Nml6+3ZHcwrKF3sSIED26I2 mR6w4o0m3vLb5ESolkxuIpaJugJLT+F78jc3Pprtb/qTYye3RmNq3lQdFnYlTezqX3 aBpXIx1BliMv0YLgyoab3QhGlXThAx7sv6WI/eZ4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726537AbfHLOsd (ORCPT ); Mon, 12 Aug 2019 10:48:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:59232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726710AbfHLOsd (ORCPT ); Mon, 12 Aug 2019 10:48:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 307B7206A2; Mon, 12 Aug 2019 14:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565621312; bh=nSx2VtkkIFSCQ9VzHGXwUxoMmn9vUIkc8WGbPO6iN2k=; h=Subject:To:From:Date:From; b=dCI8cr/e92Y8vDwd1s5Bo+Ich06Xc5/CKbAaCbDT6ehyiqO2PR3IQX1e2sSAZqEkC ccXN/zbswAaIYEmTDWx8l0H8oUlkZ2JWxO/giiJfgiIwmlhxJBmvMsNflF9IObgTzp Vje8FAr1w3sPD0YXtMhCNq1R5i+rB5Sorhb83zQE= Subject: patch "staging: comedi: dt3000: Fix signed integer overflow 'divider * base'" added to staging-linus To: abbotti@mev.co.uk, dcb314@hotmail.com, gregkh@linuxfoundation.org, stable@vger.kernel.org From: Date: Mon, 12 Aug 2019 16:48:30 +0200 Message-ID: <156562131020573@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 staging: comedi: dt3000: Fix signed integer overflow 'divider * base' 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 b4d98bc3fc93ec3a58459948a2c0e0c9b501cd88 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 12 Aug 2019 12:15:17 +0100 Subject: staging: comedi: dt3000: Fix signed integer overflow 'divider * base' In `dt3k_ns_to_timer()` the following lines near the end of the function result in a signed integer overflow: prescale = 15; base = timer_base * (1 << prescale); divider = 65535; *nanosec = divider * base; (`divider`, `base` and `prescale` are type `int`, `timer_base` and `*nanosec` are type `unsigned int`. The value of `timer_base` will be either 50 or 100.) The main reason for the overflow is that the calculation for `base` is completely wrong. It should be: base = timer_base * (prescale + 1); which matches an earlier instance of this calculation in the same function. Reported-by: David Binderman Cc: Signed-off-by: Ian Abbott Link: https://lore.kernel.org/r/20190812111517.26803-1-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt3000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 2edf3ee91300..4ad176fc14ad 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -368,7 +368,7 @@ static int dt3k_ns_to_timer(unsigned int timer_base, unsigned int *nanosec, } prescale = 15; - base = timer_base * (1 << prescale); + base = timer_base * (prescale + 1); divider = 65535; *nanosec = divider * base; return (prescale << 16) | (divider); -- 2.22.0