From patchwork Thu Jul 20 15:58:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 704583 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:365:b0:317:2194:b2bc with SMTP id f5csp570370wrf; Thu, 20 Jul 2023 09:00:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNwLenRGeT71VlU5reT1eTu99rvtL7hKO57ReDyfKDjp7MY0IrtfuFRyfwtCveX9hqtUZ8 X-Received: by 2002:ac8:5851:0:b0:403:27c5:ac79 with SMTP id h17-20020ac85851000000b0040327c5ac79mr3255458qth.54.1689868813091; Thu, 20 Jul 2023 09:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689868813; cv=none; d=google.com; s=arc-20160816; b=L1X6gg8UWsnqAu314D1Vi4iYQBLeoGtlygGB22GI1uggT8QHMoe+dj1nt/Hz5TN9CD kzRoJIvd/H3r+6OSP4tDEi243ArkiiADnl1o9RUzdlbupSTs7w0FQP+pveqfwY8IHxQ4 1cDYkmi/yG52h3q27ChrZsv5qd3IktPQqJgvNB51l/GMqu3AiasAn7FtnBQKVi002jCe Gs+zsj9r3cZQYR4lWmxazDLcqhIDUVwCNIm9oIfCdrQIK8dWOvx+VhVbfYohCDvQRkav ZPSVUYWrT+BU4NWbMO5gBE5Ft9ucNg44140KWYCgHkZIAe8yz+2y4lOixznWxAVZlY8S Prcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SzNtfI3TP/wA6vffJRkjpFoMkJ0EgXW2e/UYOIIB1hM=; fh=lIqbxpHEzubfCCroXY/oPi4oahgr2te52JU7bS9LUSs=; b=L6beo2rmywC3XwAlPEI38bVjgds/OUgUmspP1ClKt0YNczQ+3YYoI3u1hqzdvPUAtQ Pumvb9kOAOSVDJ7J9j2yurG5PGGJPitg8tRQntjEu/DGl5xL37rmfxOHlYfEcpjLVilK z6CmASEKHbpeRd+oG4aNb+JBB+sgsTBcrxeFJkOwuqA8yTWqncGnYabh+Ebr54yG/S8H UjPb+UQq16enfJtol0PT1eCcNAoQpW4t8Yx8dF4+nX3R5dv4ThBmxw9RXCwPjvr2KO9I paJc4CBzYkC26kB/fNnACdy1QtxxSGe9OAgKDEUByIYt587H9axHFpS0ggue5SUoXQtI uG1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RDhqxn/2"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s12-20020ac85ccc000000b00403a491f7e1si482752qta.50.2023.07.20.09.00.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jul 2023 09:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RDhqxn/2"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMW3s-0000Yl-Rb; Thu, 20 Jul 2023 11:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMW3X-0000Ww-R3 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 11:59:07 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMW3V-00053Q-I9 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 11:59:07 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742eso8466985e9.3 for ; Thu, 20 Jul 2023 08:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689868744; x=1690473544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SzNtfI3TP/wA6vffJRkjpFoMkJ0EgXW2e/UYOIIB1hM=; b=RDhqxn/2Q8IIgM96ul0f8XeG+GNYAYGHkTKcTCuTclukKJy0YzZUFmukxxrMJ2iLQW KInMu+vYFsFOavLudpWtGeKdO7ONrBneD4h9eBgsXeUWL6ANlFrHdN+61XeOJw78r+GV T13xNY9zBbRSxC03xX5xzo3/zF8qcas/CdLEEK00WmSvCJjMfGVmbQpxPns9B5KfG4SI v+kMUjqKkbL40cehsJjWlS5XYgNYlztpTty6bzm7EDeeCqgeLWqIIvV7w8itFQHcKJgO cJ6XEHk5q9BeYG2DG9gfX6Wa6MzGVdTgyEmeuQgQXngM3TMQ1LTtZFUH/x/mEgrzjYPo YhKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689868744; x=1690473544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SzNtfI3TP/wA6vffJRkjpFoMkJ0EgXW2e/UYOIIB1hM=; b=LVbTueV7rnqIZYXi02WWrHdhslHbSsFN/r1si7Ww08DT08kEH2qfMMtkOZESvS80wX 59j+4n4mkM2puSTw8+tjbgGw8WoHA7INdus/vwHy+xCW0yZ6JLCvjRdX3zuvxSYZnKiv Ue4vQDnngzEzscVruG93G5PXUouB4qtLtzQl5Wt6q1xnIuVJQRURMB2k3chMttFudJec HV+v47LV22s9NXtBZDeXW40+Jp34G0UAXhJa7GjPmbLNrOuCO0FkipQozcyGdV0qYLYE mxPx14WO+pkZeoI7FyS+MJLczHcX2mKSnckfUMO8jnYK7NXTw+Na/ycP7wYibzqS/vBm UPTg== X-Gm-Message-State: ABy/qLacjLYULK9gIpBQ4Nhgz/24ppd0kv8shiHMEClWbXU0tH1HqqXD g5Stdt3rhTnHUuIOr/Q1iMBo0K77+9numoSxRak= X-Received: by 2002:a1c:f30e:0:b0:3fa:91d2:55b6 with SMTP id q14-20020a1cf30e000000b003fa91d255b6mr2251865wmq.9.1689868744058; Thu, 20 Jul 2023 08:59:04 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z5-20020a05600c220500b003fc02a410d0sm4187572wml.48.2023.07.20.08.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 08:59:03 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , Andrew Jeffery , Joel Stanley , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= Subject: [PATCH for-8.2 1/4] hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm() Date: Thu, 20 Jul 2023 16:58:59 +0100 Message-Id: <20230720155902.1590362-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230720155902.1590362-1-peter.maydell@linaro.org> References: <20230720155902.1590362-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In the m48t59 device we almost always use 64-bit arithmetic when dealing with time_t deltas. The one exception is in set_alarm(), which currently uses a plain 'int' to hold the difference between two time_t values. Switch to int64_t instead to avoid any possible overflow issues. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- hw/rtc/m48t59.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c index ec3e56e84fd..2e2c849985c 100644 --- a/hw/rtc/m48t59.c +++ b/hw/rtc/m48t59.c @@ -133,7 +133,7 @@ static void alarm_cb (void *opaque) static void set_alarm(M48t59State *NVRAM) { - int diff; + int64_t diff; if (NVRAM->alrm_timer != NULL) { timer_del(NVRAM->alrm_timer); diff = qemu_timedate_diff(&NVRAM->alarm) - NVRAM->time_offset;