From patchwork Wed Jan 17 12:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 188822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp885705dye; Wed, 17 Jan 2024 04:53:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPW6CIHJWw1rgt8FZnPnb6EkejBbpHnoMH2jpM3BGCwq8fbFlXer1nioBll4h5smQs8hEz X-Received: by 2002:a05:6122:1b88:b0:4b8:ce85:1e97 with SMTP id es8-20020a0561221b8800b004b8ce851e97mr4222231vkb.20.1705496005473; Wed, 17 Jan 2024 04:53:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705496005; cv=pass; d=google.com; s=arc-20160816; b=Xqtv+OheY/ScgFEpBd1MMyPgUwaHe+IDQ2d3jjPgZpFSjEB1j/otUK2fsYA+lgiS1t rbrXt3sn0EGrHOy4cA3COVMNPNtGqmSQw99wpoWC0se8Dg3ifUNpHE9stHdQvhnXjg7b JABuUjeYt6ae1Shwys5H5lH25lKj78dCAstm+Bm6uhrVw3AhLlnxT9yHzGfru39j2wkW zwJOZ3O7QhcniW9VXWjleQ1NmbpsdR2/8unK6f7zLSP3Ivu4hGLrjTZnN0ZfehWbzeg0 u/E3T2jvWAUQSB7Q6HeCKSdYDrJOgydzZO6qVKEsvBlePUqbrJpVPcMhjYuiWMrAeGaa chSA== 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=pGI0D05eJ+uxsZQGv4OCXwlgzFlgbXKFeDQnZN4BBMo=; fh=kdyF9EYG/tin3sA8xOB4bKJfeNLBBY5Ng7B6Lboao4c=; b=VfoHp/kEHJtO6+22yAENznfYQMNUr0xGjfbHnBJVSzHOzJbCAIKqDo/97IaklQQITv 9FI38Lct5iwq7fRlPvLuwRb+4dkqDgSFfO+9qycA3mPnQNuPO2W8TQmt/KBzFwhEQA+P tWNPVlI7ZgwLhWkKRlZWR0F5wbVj+bkC2YlNwrZ/h27LKrYFNFZ1BO4SAzTaTCkKREdM ZT+1NPzRPGDIuoqvPOgfM7ovL7GXDIcPtzGfd4+OoegnlhHRxJKpiwO86lYv1kmobyCS EzAhXsyRy9lkgeTc2NuDEK98wZLODF/N0GmP/PBv1XGpAWFUM/PIdgR6uezDlUS576ss x/lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=q4Pb8xR2; 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-28993-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28993-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t2-20020a0cb702000000b006818753305bsi87503qvd.571.2024.01.17.04.53.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 04:53:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28993-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=q4Pb8xR2; 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-28993-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28993-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 415071C210A7 for ; Wed, 17 Jan 2024 12:53:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5ED7C1EB29; Wed, 17 Jan 2024 12:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b="q4Pb8xR2" 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 6DC0A1EA66 for ; Wed, 17 Jan 2024 12:52:06 +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=1705495933; cv=none; b=J+hVzfwxbskfKK65EstkTY4YZaEpqtg+w/1i7T1lDYiMjRrsozO1NRZMF9Jgm2LCoRhikM/X2xwoS+mx1vcdRNl7096fRcLaBpr/BZmQidk4wkJ7lcd4w9SpykwtpZMDWj5hjPaArP8dD3VFSFmsneAR40kVqtec4gUaSfU3tkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705495933; c=relaxed/simple; bh=/mrGijzcsXN5iPj8NAqokoHh+7OsAXjyewzktejtc+s=; h=From:DKIM-Signature:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding; b=q8wUScNUrmF1QXIs6QD1Bu4DaK33I4KEuKVfGBvG1GQRx7BXOBrhwTCUWvDJiQoZeUNsubAyJ5Q8uCgeX9kokrwuUC+9nq0YmbTEfE1pfELqH8wwb52jIXhF6KcKToqKL2w/8uQYiS+7xH3stooBLbYs3VKiQ/SJMw7KZCVoKns= 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=q4Pb8xR2; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1705495349; 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=pGI0D05eJ+uxsZQGv4OCXwlgzFlgbXKFeDQnZN4BBMo=; b=q4Pb8xR2Le7s8FICVd4sbQMgz/ILE1f1a0DMVmUVvDHP0zXmGR6NPKShbe8iKxeBTxYBnH m46gkMtMTvSER9wjKevQIn83VBQJxErZmdpuLOLtHyID12dGWwrig48GfnBRwMh5N8vkcg jM1ZYPwcuVd8wmhkS+TjDmGKgjcmKFg= To: Ian Abbott Cc: H Hartley Sweeten , linux-kernel@vger.kernel.org (open list), lvc-project@linuxtesting.org Subject: [PATCH] comedi: drivers: ni_tio: Fix arithmetic expression overflow Date: Wed, 17 Jan 2024 15:42:29 +0300 Message-Id: <20240117124229.37455-1-arefev@swemel.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788342179076637477 X-GMAIL-MSGID: 1788342179076637477 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. Signed-off-by: Denis Arefev Reviewed-by: Ian Abbott --- 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 * 1000UL; ni_tio_set_sync_mode(counter); return 0; }