Message ID | 20240119080307.48944-1-arefev@swemel.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-30876-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp857772dyb; Fri, 19 Jan 2024 00:03:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXBa/fkWTWXapC0/gKAKRl8TmuADBRj4AZnEiisqW0kMRv8p0moDRZmh4H3cFXpW1Y9qni X-Received: by 2002:a05:620a:404e:b0:783:1887:80e6 with SMTP id i14-20020a05620a404e00b00783188780e6mr809485qko.35.1705651419039; Fri, 19 Jan 2024 00:03:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705651419; cv=pass; d=google.com; s=arc-20160816; b=YuZCl4xnSCdJgw9ahPyCS1BVEX0DRawJ/5x4fsLP3yNaS+tpyuKPo2E1kPIWkynmkd JHIAjRFH9JBXWjnx0EWxM5NiZNv2Hviz5n0kJSNpAlzMfTdywLV+QjPfezHTmEwc5gmL 3AEU4mXymx/iRRVUFdZDHn+HiKz4MGgv4ntgfGB8NbyupyigdPpvyugywgJKfc9FZGHu o3O5hBZRIEg9LXgaJxULPCQoxT707oyFd2oIpRijYvUVYpmPp8anjjj7i4SGhNzjzQrN HLiXqAOZblKNOep8PAuAeEPf//jgRgdxYl7RxXHhdtoca7kUnyJwbK9sKIui//9BivAM Hl5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :dkim-signature:from; bh=kZ44b7hysLq9iTugi8rkv8vLiPXIxMp8DXNRpoizLSs=; fh=aTtXnrKw9eZMiqaOnzqKQgsfy0mkH8plsV+WXgSSxm8=; b=TK0olOr/I8fKLi+Ed/qw3SCP5xJ/ZPU3uqQb8GfUIUW1MAQRzXxiYcW1TSs8C6w/L2 Y9mK+Tzy9pYrSh9ukCNFXDR/IOLVPkAd5JWQ2o41eorv91cyLFpYYEYokTzBjZmjdpR3 yz0mpireAGcxPA6tm8QwEB25X1NTfeehKAv9rRua5/9tiDaU4Sk52i04WfLNpY2I2BEr nQrO0rzdxZKaLJgc02xxkSVC9vzvx+rG2C3JcUeKb6jIg9GIjvNWUZXHax+mJ2YejAUg yFKR7699MK/oFPvNEWDHnE8hfTu0o3EeXIk9Ve95INMLsd0s4m6a7JHX6vmQDVJUCeUV /7og== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b="RQYlo/km"; arc=pass (i=1 spf=pass spfdomain=swemel.ru dkim=pass dkdomain=swemel.ru dmarc=pass fromdomain=swemel.ru); spf=pass (google.com: domain of linux-kernel+bounces-30876-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30876-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s6-20020a05620a030600b007833f17b4a4si15419008qkm.579.2024.01.19.00.03.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 00:03:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30876-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b="RQYlo/km"; arc=pass (i=1 spf=pass spfdomain=swemel.ru dkim=pass dkdomain=swemel.ru dmarc=pass fromdomain=swemel.ru); spf=pass (google.com: domain of linux-kernel+bounces-30876-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30876-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D19C11C20DDB for <ouuuleilei@gmail.com>; Fri, 19 Jan 2024 08:03:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD6622030D; Fri, 19 Jan 2024 08:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b="RQYlo/km" Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E57E3D53E; Fri, 19 Jan 2024 08:03:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.143.211.150 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705651402; cv=none; b=VrVcF8wR0x+S8EuXiLH4x4GSDG71yuiY4L6iqKyB1CX+61Gd/dtsr9VrvnoxEtNbnJhYmElcv9Xpzjq7pRLcHXn+OUaQ8qS65Xr0FjS2J3Mm5HJnZgtp9uRjgGPCXZLQhXYVqT1LkCJ5Ks1LFePOwaNJ7UiM/Hahf/VOCIaCgtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705651402; c=relaxed/simple; bh=0oCwPoNsmKLIpr2t1p4Hjr8yVMRRpG92q4+h1zMfNek=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=YwPTvwyDDvXZCj+7sV7HZeD2Vd0TXLO6zYWc9E0sLLJ+ZfvX9vkTFqvXQBKuc/KfGJCb4vvlixR4CVTohJmD2rGgj15DAMfiNh2CwZJba6NA5GL77tga81Puc7FORQV6zCFwsVOXLCjNj1VI6kf44u+P3pnq4fW7vn+8K1nhjSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru; spf=pass smtp.mailfrom=swemel.ru; dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b=RQYlo/km; arc=none smtp.client-ip=95.143.211.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=swemel.ru From: Denis Arefev <arefev@swemel.ru> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1705651387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kZ44b7hysLq9iTugi8rkv8vLiPXIxMp8DXNRpoizLSs=; b=RQYlo/kml3d5GyVYGKodxW+a/HfGcy9bm+WodODZtCdiYzWsXq7/2kHUFl6x1uFhZTvHP7 ghF4lPZZUHJn0xTUBRqxWFu2QQ7XVP52iWqj46td3Cl57Jpifjswsi0Gz+KUWumhYOea9r qE67bsxw838VsX6Ybf6XE1IOK6tW95o= To: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, H Hartley Sweeten <hsweeten@visionengravers.com>, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, stable@vger.kernel.org Subject: [PATCH v2] comedi: drivers: ni_tio: Fix arithmetic expression overflow Date: Fri, 19 Jan 2024 11:03:07 +0300 Message-Id: <20240119080307.48944-1-arefev@swemel.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788505141975363851 X-GMAIL-MSGID: 1788505141975363851 |
Series |
[v2] comedi: drivers: ni_tio: Fix arithmetic expression overflow
|
|
Commit Message
Denis Arefev
Jan. 19, 2024, 8:03 a.m. UTC
The value of an arithmetic expression period_ns * 1000 is subject to overflow due to a failure to cast operands to a larger data type before performing arithmetic Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 3e90b1c7ebe9 ("staging: comedi: ni_tio: tidy up ni_tio_set_clock_src() and helpers") Cc: <stable@vger.kernel.org> # v5.15+ Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Denis Arefev <arefev@swemel.ru> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> --- V1 -> V2: Oh, good point. It should be 1000ULL. drivers/comedi/drivers/ni_tio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/comedi/drivers/ni_tio.c b/drivers/comedi/drivers/ni_tio.c index da6826d77e60..acc914903c70 100644 --- a/drivers/comedi/drivers/ni_tio.c +++ b/drivers/comedi/drivers/ni_tio.c @@ -800,7 +800,7 @@ static int ni_tio_set_clock_src(struct ni_gpct *counter, GI_PRESCALE_X2(counter_dev->variant) | GI_PRESCALE_X8(counter_dev->variant), bits); } - counter->clock_period_ps = period_ns * 1000; + counter->clock_period_ps = period_ns * 1000ULL; ni_tio_set_sync_mode(counter); return 0; }