From patchwork Mon Jan 6 13:40:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13927447 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 407171DB34C for ; Mon, 6 Jan 2025 13:40:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736170813; cv=none; b=PwVrowReuelxOfIGhcBYX4PqNGMuv+SV2Rq2PWYpwdoWsKQmW42Phq1v5djPZvu9kJmnGag/4BIGkWGGba8I3WCKx+dHgxHv9LL9tIU6J+Ie8MjDkuQh3cg1djitrIRrkIts3AMS8WK4fZ+7BkLc7NWBOS02ObNsQKhXRASX5t8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736170813; c=relaxed/simple; bh=6S98sC9zb379SpXjPj44qvbnzAChVkkYXuoHqOebMyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ADE5274KTueHQ/bG7Z0KkFzzEgHFWNOazIjuzdWOr4z6jGuDq/VTximvkNdFPiRnsaUbtqh858iDbkR5dKuKm33acVZHlIBCkiLi8WfDj93plxd2l1E3vUXyMEzeQrREd1AicjusUYKdksLlJypt6Y1aCkfBqwH++L9lhh83/W0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kncgcZxE; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kncgcZxE" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7b7041273ddso1006625385a.3 for ; Mon, 06 Jan 2025 05:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1736170811; x=1736775611; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1sua/H7q/HxBmtn5ehYvB6xIDSURBEgE+eseMuH9rt0=; b=kncgcZxE+nBN/bBF+yiZX3cdt+EhOgfulXyNO8OT6URRm2wHJFX5LnH/1LaVH81cxH wKO54jBDLv3VQ1vjsWJIb4f5SUHhVrmGISlKnT3S7TzbLB5FN8ocZkkLe5lHXmL1AGaC kCTFK4/URJCBqLYNKduqa16gpwyYMMUVyWyKs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736170811; x=1736775611; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1sua/H7q/HxBmtn5ehYvB6xIDSURBEgE+eseMuH9rt0=; b=hucfpk6LGq2VpcxObJ9pn7hXOhf14hqn1JZThoXPpgCvkrLSGRuioPpoheBvehsqLQ U1CDSaEio9QAYl8xjsxHXbS17uYyXEAZHAvCTQjZBETz4bkMnFklnV9ztPv/zAnWxqLx SInYlPF0nEE87Egkdxx6Lzb+319Deh1yCJJ9KhWNAC1XnX87OXRmSuYn1vIqmedcddDm wT2H0W5QmjQkZg09Kr4i5E82QyyuSKeG+BSlvr12brUOAHiztZyoTCWLQQ0T7Zr/1JE8 qTAkWJLvXrCetJ7T9Jq10xAzjY7aX6oQMdmgu1Po4ZkDtY7AY4RXPAzx4jvuCVx3HsGW Cneg== X-Forwarded-Encrypted: i=1; AJvYcCV79chpjgfQp0lOkM/5NRJfYHa7mhkCn0UgsKuY5naRwryWUNcPIAPDAJULDsOUbYd3zdrim9LLTd+HPo/w@vger.kernel.org X-Gm-Message-State: AOJu0YyMIeB/HQ2wgXgdk8GctE3M6TfgZlutyzJk9We933of4AmapLEK 86EWKts30GQ2CHGsyexxJpdtFBgqeL9WEYMRn5uTPI3FXHNhcFE5MO0m+RrUVA== X-Gm-Gg: ASbGncut4EwDUP+KDI4KLaWNEEpcqvNPA4IerhvEe98IPewY9ERWpgmNbZgPA+FAz1e +exN4/9SOHtjK75iCOJI//KgkB77CCVCDRZK/h+J41RzG/gfFjqQhJ+46E31we0qHqQwhB8VZAe OFIttVGl2MplrcEBwsQnbzkEm9pRxs7Pa8X2EFbhfQFxcAKaVfiMFSwUmzlOuttTxKhyb846gzR hhbyKkFhJviE025NvKdyyDR//GGEb/mDmfI09z+W1+Rm3dcI1NlBDKEiAf4ry+RIHPh29YLeSbD vQw1Sb2+lY8eLXgqUnY62S8ZxiNP8TmtV973 X-Google-Smtp-Source: AGHT+IHL/i9PYol7/BeTRyIFkBBCg5WCtmISC7fUpGW6mAhMPY0gQu9kkKdiaUQVy0qOM3paHIXmwA== X-Received: by 2002:a05:620a:4410:b0:7b6:ea22:3069 with SMTP id af79cd13be357-7b9ba79c26fmr8894375485a.26.1736170811310; Mon, 06 Jan 2025 05:40:11 -0800 (PST) Received: from denia.c.googlers.com (172.174.245.35.bc.googleusercontent.com. [35.245.174.172]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b9ac478d35sm1501861085a.90.2025.01.06.05.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 05:40:10 -0800 (PST) From: Ricardo Ribalda Date: Mon, 06 Jan 2025 13:40:09 +0000 Subject: [PATCH v4 3/6] media: venus: venc: Ignore parm smaller than 1fps Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250106-fix-cocci-v4-3-3c8eb97995ba@chromium.org> References: <20250106-fix-cocci-v4-0-3c8eb97995ba@chromium.org> In-Reply-To: <20250106-fix-cocci-v4-0-3c8eb97995ba@chromium.org> To: Mauro Carvalho Chehab , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Hans Verkuil , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Stanimir Varbanov , linux-arm-msm@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 The driver uses "whole" fps in all its calculations (e.g. in load_per_instance()). Return -EINVAL if the user provides a parm that will result in 0 whole fps. Reported-by: Hans Verkuil Closes: https://lore.kernel.org/linux-media/f11653a7-bc49-48cd-9cdb-1659147453e4@xs4all.nl/T/#m91cd962ac942834654f94c92206e2f85ff7d97f0 Fixes: aaaa93eda64b ("[media] media: venus: venc: add video encoder files") Signed-off-by: Ricardo Ribalda Reviewed-by: Bryan O'Donoghue --- drivers/media/platform/qcom/venus/venc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index c1c543535aaf..bd967d60c883 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -411,7 +411,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) us_per_frame = timeperframe->numerator * (u64)USEC_PER_SEC; do_div(us_per_frame, timeperframe->denominator); - if (!us_per_frame) + if (!us_per_frame || us_per_frame > USEC_PER_SEC) return -EINVAL; fps = (u64)USEC_PER_SEC;