From patchwork Thu Mar 25 10:29:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 408772 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp401638jai; Thu, 25 Mar 2021 03:31:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLsMnXvmp5giAVlKjsMaJEF5AKpvfsxKSQV/W3LNbL3qGayYtuz1HxPL3b37ZhouJdcNG8 X-Received: by 2002:a17:906:8408:: with SMTP id n8mr8287573ejx.152.1616668271893; Thu, 25 Mar 2021 03:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616668271; cv=none; d=google.com; s=arc-20160816; b=RNY0IneDI05v1rc/ckeI/IASEkom6yh6JnooxjLXXP3bnNjb/sQmxdtjOH0OXB/G1t USnGiVRkoMjUw4v324tQdmpXf/Zjs1bdED6yqp9A8Nqi2GDEE+0n2yzQPEXZbHcgvVg/ sHW/glkFgTXs5R0Ps/DOpNjbHGqlcv6/F+PRM9JPPQbet437CgQ+LTAQn+vS0JVECece vj56Hv6atSVfJ/gR0j7V9CiYRPYD7jKHaCuBVgXxEIuzxird9/ByB0PYVicIv03Q+3hO H/UEwx4JmdMqxj3y8V+I/Mc2Avf4MH7dd7Z/adWm7DtfX/rN8ZH3+MN06lqq7j0VF+rb Pe+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=4LQrkxh9XKHSRaKe0wqWIdW7sIgBGHX5Nu3p1oqv7x4=; b=Lpay4XTRIh8PuKLmvxYDCegt7N2yfrw6G5uLaMPqPBPTqhqxzwuBhQJAWCR/ek8iT0 pn3XicRoleloyrcMvAnLQPGIVnxwWbHi/G00eFbniI4l6dPqKclVHQyNaDgKP3WKmR0E t/h2nVlUjwo6hnVrBWmVMhih1YxGhK2OvYC4u0LuN4bvd6hKr/b/9s9I0k+ttxg2hrP4 0zPwNRFownZLmoGVj4Ot4YXoFwSoRgWSlBzyP8FTNuE873pJ9K3Wrh8ztJ3H376JT3ro b6aksNFw6BDg81LuQ8/ywTS6nFrCwwm+vW6rUg3P0ryQk88FMZ+3hreEDLv4mWxIRSby yX0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ktbIalbI; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si3991646ejx.518.2021.03.25.03.31.11; Thu, 25 Mar 2021 03:31:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ktbIalbI; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbhCYKak (ORCPT + 3 others); Thu, 25 Mar 2021 06:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbhCYKaQ (ORCPT ); Thu, 25 Mar 2021 06:30:16 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B5ABC06174A for ; Thu, 25 Mar 2021 03:30:14 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id z1so1800039edb.8 for ; Thu, 25 Mar 2021 03:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4LQrkxh9XKHSRaKe0wqWIdW7sIgBGHX5Nu3p1oqv7x4=; b=ktbIalbIIhDCdyngNwWDlOVfaSjCsoG/22ZJREjlWiLrrXgprFTB0BRCCY5DIOZcg4 nVaPlzjlWEjDEKW6czVHMHIayNA/dLCes0Q4X7dg/t85hzwjLtLZbYjow3EZdOHGinY3 Ps8k6UduYvXcIs2ySVvKAmWMWFh6bv8ZeyZjRboLNqMTh7J/fGSfdketOF+kKtFiyunk wvEbAaHr9bcZ29A1UKgGrLvRqbeR8pki0wCOph5VuBPlK8yxgVRIar3rfezQ0cNozVHE v+TiHsx5GUm5HaMQMBEXLjlv8vc/qrd8kotXON8EIbKGzb6c8htA30rTKBxLdt5ApG34 I0OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4LQrkxh9XKHSRaKe0wqWIdW7sIgBGHX5Nu3p1oqv7x4=; b=W2YypOmIXPBHBns+F+E15eHev8RzWeY6T81nCJs00m5OxMiz4ms8zcRP9tUfU46WFx rvnHaEC3q1rCwmrNPfq96BH//x/cMGPDETS7uyMej6yi4sUGxbfFwMO+D8vDeK5qzzGv AX/sGkqhT8reEzSWusB+x6auiCp2z37dq+4ZhprTkNf1JDuf/BPrSaGl+vrST/zqh97A DqimsEPXh5rxyTeYXpOMmOFZ0E3s5eK1bHFf1URSdDBmmTSef0PXX1EBfTjeGrm9DSFo Nbg9KTU9VqLEWkZEwnpdSwXwHGq8SFwOfkbFk9uXoZzz8Awclz6ehoQsW2/+1o1Hri8k FY/g== X-Gm-Message-State: AOAM532H6v+QdFQqkAIdZY8Ubka9Q47uehIOk4vQcNg+YpKTHTSI6Lbg yS/y28rNPWnE58fiqPxr5FpxH4kcr+c+y+50 X-Received: by 2002:aa7:cd63:: with SMTP id ca3mr8274164edb.265.1616668213051; Thu, 25 Mar 2021 03:30:13 -0700 (PDT) Received: from localhost.localdomain (hst-221-104.medicom.bg. [84.238.221.104]) by smtp.gmail.com with ESMTPSA id z20sm2407661edd.0.2021.03.25.03.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Mar 2021 03:30:12 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Arnd Bergmann , Hans Verkuil , Stanimir Varbanov Subject: [PATCH] v4l: Cast timestamp tv_usec to singned Date: Thu, 25 Mar 2021 12:29:52 +0200 Message-Id: <20210325102952.1126952-1-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Some of the MPEG4 standards allows negative timestamps. Correct tv_usec cast to s32. Signed-off-by: Stanimir Varbanov --- include/media/v4l2-common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 3eb202259e8c..1ed61416003a 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -544,11 +544,11 @@ static inline u64 v4l2_buffer_get_timestamp(const struct v4l2_buffer *buf) { /* * When the timestamp comes from 32-bit user space, there may be - * uninitialized data in tv_usec, so cast it to u32. + * uninitialized data in tv_usec, so cast it to s32. * Otherwise allow invalid input for backwards compatibility. */ return buf->timestamp.tv_sec * NSEC_PER_SEC + - (u32)buf->timestamp.tv_usec * NSEC_PER_USEC; + (s32)buf->timestamp.tv_usec * NSEC_PER_USEC; } static inline void v4l2_buffer_set_timestamp(struct v4l2_buffer *buf,