From patchwork Tue Jul 21 22:50:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 1333378 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=pTf9dtli; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=SqlOrNmo; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BBDPt5yVFz9sR4 for ; Wed, 22 Jul 2020 08:52:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=AUbo+5ECVQTQ7B9uC1T1Vw5LoFI3HiSdd39lTMbOWN8=; b=pTf9dtli+OrjpVMaM0yJO/uBUU EVbiSAytS8sdmm8lE/d2poHynWZn6je/eozuARoJxtJxW4qMC0A+meBA6qtplkhlwPtsjVqSFqsSd TFNBoO7du1B9F/s+LodhomIuSzs3PFPAWOuE3Y5NpNdJ9FAY6SHWO0A7KqJVU6Q51dPTztQsBjWrJ TnieiZT7d2MRE0DMj5FADM+hSEg5YAK6zkTBK9aFfKpdhwptaZQ0pcZywxlq0SVxljygvGdz/1z2D rAt4Fej0KEQQDW44jgRnhgskDKKF9rbtDQbN6DyOdHJmYrBcDwoohQE+kSH6DBMftyVBjK6Xs8zjI IjtOXaWQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jy15w-0004ZD-5P; Tue, 21 Jul 2020 22:50:44 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jy15u-0004YT-N0 for openwrt-devel@lists.openwrt.org; Tue, 21 Jul 2020 22:50:43 +0000 Received: by mail-pl1-x643.google.com with SMTP id t6so15333plo.3 for ; Tue, 21 Jul 2020 15:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=QjZ7POLywaNG9DvYfmuZGiRwFKl7slMaYhKN4EzVWMk=; b=SqlOrNmonFFGRCfr1Gf9+KB3QaOQRttFfbU03I3szF2YkGH7WNpmjQCex86IBaGQvm AqRniuhiEpw5v5LQ6ZGl5oGjX72O3xISDCSZFo5yhO6aDW1IY1VKF3eGsR8nKZpEN/01 P9IN5Ssdch5E3ycLTr95p50RpnYa2NsRbsecRgDzt3zWdVLwEXwo2EMbeWl1NT+fo3GN 9v3MGJ6m4C+cG1ov6E+gSQMx2gkvvHdLdObp943afhf5aXOUA/ttmLZfXkGfBxwG74zz NUx7ygtlXMT9j3AN1+4/vARvGXwywR/wI7VwWan4ghNy42ppgCXYXeQcWCQdfVrUV2/L lWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=QjZ7POLywaNG9DvYfmuZGiRwFKl7slMaYhKN4EzVWMk=; b=WPVrf9cbaz6/AzhByV90cp1MEFzNA6GHnjHxYy5zyu6CDyKSv4O1StsTCLstxzIGUU H5Sj/DqOztAAc6bO4pX53q1h2M3bL5/7aWE0FqmVeIDi7J6yr1wnCJNiNEODLarQcQhB Q2iEWSOux6Q5P7ey7OrIsFiK9uzQjSp6UUHfX5sUkJtviudaBDXMQRaMCxK/K67HSAe2 jUewGGDhVWnMABm8IyOS0PBwLbER70eK4UvIvWlB0xRwH7D7kGovedl2hHL+Q4gLYnXw ws7e44uNRy/yO8tuF8YuIV92lSYTCbQCUuIZxVqeJWOEd7LT/plh9SI0WrOhzSC/esg4 FXig== X-Gm-Message-State: AOAM5331hfUUzTKeOSS+4ACT75IcmlPRwUNavVqcwTzamg3CfLm+CE8R p2wyh4RS7bAKmM2Jj+92yunCWMb/ X-Google-Smtp-Source: ABdhPJxq5p59DApTuyz0B02vFGIMBbFfi7uXFh8+G8zBs20xP/CxZTVMEnW2CSOEEbVr9f3Am+JpQQ== X-Received: by 2002:a17:90a:14a5:: with SMTP id k34mr7381085pja.37.1595371838647; Tue, 21 Jul 2020 15:50:38 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e:64f4:ec15:778c:e670]) by smtp.gmail.com with ESMTPSA id b82sm21369092pfb.215.2020.07.21.15.50.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 15:50:38 -0700 (PDT) From: Rosen Penev To: openwrt-devel@lists.openwrt.org Subject: [PATCH] ugps: fix 64-bit time_t Date: Tue, 21 Jul 2020 15:50:37 -0700 Message-Id: <20200721225037.97851-1-rosenp@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_185042_788775_62E60484 X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rosenp[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The abs function takes a 32-bit int, which can cause truncation. Fixes compilation error: error: absolute value function 'abs' given an argu> if ((sec < 0) || (abs(cur.tv_sec - tv.tv_sec) > MAX_TIME_OFFSET)) { Signed-off-by: Rosen Penev --- nmea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nmea.c b/nmea.c index 8df7792..1204c20 100644 --- a/nmea.c +++ b/nmea.c @@ -107,7 +107,7 @@ nmea_rmc_cb(void) gettimeofday(&cur, NULL); - if ((sec < 0) || (abs(cur.tv_sec - sec) > MAX_TIME_OFFSET)) { + if ((sec < 0) || (llabs(cur.tv_sec - sec) > MAX_TIME_OFFSET)) { struct timeval tv = { 0 }; tv.tv_sec = sec; if (++nmea_bad_time > MAX_BAD_TIME) {