From nobody Mon Jun 8 07:26:55 2026 Received: from mxd.seznam.cz (mxd.seznam.cz [77.75.76.210]) (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 029E52E719C for ; Wed, 3 Jun 2026 13:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=77.75.76.210 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780492828; cv=none; b=atdnt5gnseLQonn7Mp3MHBJGo79iva6fTK7U0f9Gm4s93jWy0clv1wntuFdSnSiocnt6oWWIyGHiq+JGpjgRuaSbtI3YgwtDA8VXWEOSz6EBfQ4rIIL3/XwP++463q4TRSNCoQyMTKQp4d4UyovLjOr81mVJ2e9TBGp333XtIFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780492828; c=relaxed/simple; bh=TeYCFJsRCwmNdtC5dl1fr8oY854INDkWFfshcBTClWs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=IdAaWaofNRhtQMCNC6QmuVRGnFRRn4cBIDmwq+OE59EIxOQ2QfUiYaI4MlSG8whDJHKVUGtfROy0/JIy5q0ZkXSJ1gX0828SH14CLolJiH0JDrz5iBFTz1J2t6Y/ULlLC9eM8m41SpTkHHM0pnylefmgkbkqDCvBtPX0dv52QDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seznam.cz; spf=pass smtp.mailfrom=seznam.cz; dkim=pass (2048-bit key) header.d=seznam.cz header.i=@seznam.cz header.b=hXU8HcmK; arc=none smtp.client-ip=77.75.76.210 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seznam.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seznam.cz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=seznam.cz header.i=@seznam.cz header.b="hXU8HcmK" Received: from email.seznam.cz by smtpc-mxd-5757bcb9c-s9zn4 (smtpc-mxd-5757bcb9c-s9zn4 [2a02:598:128:8a00::1000:a07]) id 0ed04329b6bf6ea60c2ed9b5; Wed, 03 Jun 2026 15:20:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=szn1; t=1780492811; bh=13IKAhnpuUy6Lh6IVO6R8GAyRAXG35UBulVX9C5w3hU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; b=hXU8HcmKD3cihY0+7ohn/5fNZqsmbFNrE/d3HwB6ctF27bC+y/GwbyD+Je/SCw4+D AsBDSHYjp1t3iMQVAfM3XIbweAgS8qhmcD6dmB/Ydu2AzOFFSPUq87RXGmOvUVPklR 7D6rJKD9poY+RSBLiyVRPoPRXOvyv+Mx0zWir+ykO8d+X12A7e68TjSiXka+XSclau PvUxHR6GD2vQJ3mAgOOG8rz0QEeOjjTGMuQsloJ17yT1lcmzJLb90fvGhSTGDQNOpu toTTjq5B1WJMhHjfjh1Rx4MKy9emL/ZllixqDildr4ZtVcuRcIxF4v7FstyQoqb1Zx 9HHfZDQG8lR8A== Received: from archlinux (ezechiel.sdb.cz [185.100.196.77]) by smtpd-relay-5698866cf-4zzqs (szn-email-smtpd/2.0.73) with ESMTPA id 152c4a36-af35-4b37-8c87-db7ce4b9c1ac; Wed, 03 Jun 2026 15:19:53 +0200 From: =?UTF-8?q?Vojt=C4=9Bch=20Kr=C3=A1tk=C3=BD?= To: gregkh@linuxfoundation.org, christian.gromm@microchip.com Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, =?UTF-8?q?Vojt=C4=9Bch=20Kr=C3=A1tk=C3=BD?= Subject: [PATCH] staging: most: video: Use min_t() macro for type safety Date: Wed, 3 Jun 2026 15:19:28 +0200 Message-ID: <20260603131928.44274-1-vo.kratky@seznam.cz> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Replace the open-coded ternary operator matching a minimum calculation with the standard kernel min_t() macro. Because 'count' is a size_t and 'rem' is a signed integer, comparing them directly introduces a signed/unsigned comparison risk. Forcing both to size_t via min_t() ensures safely typed comparison and fixes a build-time macro assertion. Signed-off-by: Vojt=C4=9Bch Kr=C3=A1tk=C3=BD --- drivers/staging/most/video/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/vide= o/video.c index 04351f8ccccf..709f61ed0322 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -178,7 +178,7 @@ static ssize_t comp_vdev_read(struct file *filp, char _= _user *buf, while (count > 0 && data_ready(mdev)) { struct mbo *const mbo =3D get_top_mbo(mdev); int const rem =3D mbo->processed_length - fh->offs; - int const cnt =3D rem < count ? rem : count; + int const cnt =3D min_t(size_t, rem, count); =20 if (copy_to_user(buf, mbo->virt_address + fh->offs, cnt)) { v4l2_err(&mdev->v4l2_dev, "read: copy_to_user failed\n"); --=20 2.54.0