Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp660215pxb; Wed, 29 Sep 2021 07:11:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVRUIlW/GOFJykkYHZ7styxhsONI5qcEX6G81cCR5wbm7NFLMXyrBq4raJLB5ouFuY9x1a X-Received: by 2002:a63:204a:: with SMTP id r10mr144320pgm.365.1632924691312; Wed, 29 Sep 2021 07:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632924691; cv=none; d=google.com; s=arc-20160816; b=AmJ07xhvVriV6rzV6gnwKT+FEWZ22DXGmwJchLhjQWnbRxUmqgCfPk3e9NSfGgGltI m7y8PwBMHLo9t30mcYuUfjkDL+2lm8Wb/dXzCtJlA8Dq762f6xni6ruuyIlqlvdQGEQi H6Rr7zPjx7pW54SO2L6C99oE43IBIJ95zLcfPTs7C5gQF3pXXAszYXYQscTGLKBpkdzR 4KRWpqB/LGK/GX7b9lk4jU+yhgLrN6dZNUsTxYXVvAJDV2t9XZuA+y6Yf8+KxZaMa4Xk EfuBucZkmyTp5iavIky7p6Ae7nutm7X6tZBHqC7h+Et74POhZVwDfB4FabCPevzrSCEW o3og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zfQ5dM+Ri1P9r/ui3gb3SorhujmtF4JU4NTdcKikmrY=; b=BMQESvRGUpt30MUvRI3dgv4B2fduRRvCXrpw+B0j/RVgMBrzY41p821W4kf5rx6AeS KAHSzJwJUbmnpY+vwm0OhxuBQm2cN9HYUMG9PGA8ma77RNUGhHo3Gt6HbO2CXWOoeETp RG+Y9tubArmpSl9q2YJtknU3UYn+f7t6KAENrDM/5QDx5LB+Fgq3dpxQclX94zJfW5KU m8k7AUUGQjQ9HVp5ujWwTj4E9zzvyvQLZIDIHM6SlAfbvRRm7Pzw0gq5f3++ZYNSbUrh 12zxz40pZQCbcVu2qPb6qRWDt0nCcTYkFK8SkSiHK5f0pDoq1iD64GVYQHt5YlynkOcK aaNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@0x0f.com header.s=google header.b=Bsb7ycsZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s62si1158287pfc.161.2021.09.29.07.11.02; Wed, 29 Sep 2021 07:11:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@0x0f.com header.s=google header.b=Bsb7ycsZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343917AbhI2M4Q (ORCPT + 99 others); Wed, 29 Sep 2021 08:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343889AbhI2M4P (ORCPT ); Wed, 29 Sep 2021 08:56:15 -0400 Received: from mail-vk1-xa35.google.com (mail-vk1-xa35.google.com [IPv6:2607:f8b0:4864:20::a35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF713C061760 for ; Wed, 29 Sep 2021 05:54:34 -0700 (PDT) Received: by mail-vk1-xa35.google.com with SMTP id f126so424125vke.3 for ; Wed, 29 Sep 2021 05:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=0x0f.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zfQ5dM+Ri1P9r/ui3gb3SorhujmtF4JU4NTdcKikmrY=; b=Bsb7ycsZA74HsDPL09ZQAQzDgROsLRCu95Hc6OF0nBRCNlpFqOEl7hBm5n1R5n+GxS DY57YA9QCGz0DcHNnzyH8eenAa47pYdR9FLLRm9K7+sO4Y14fI7RCyHBToxJaDIhz0cc ozkSrY4d/0ZoSX99+wPd+DDkFDbf68V2vK3iI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zfQ5dM+Ri1P9r/ui3gb3SorhujmtF4JU4NTdcKikmrY=; b=Bvz1OmZWjK8fCfBw+yerLlmyR4REX/ZZNgKBJXRbeVetmXNmOpbOP/Sx94KRjQx9F9 /pxiamBvXU2rluAYwuX+d9kYImCOoiIzuubRyd30YI8iJDL9QEnEkccXBCW9nipvP3j3 9qB9307KDxhbM/NRNhWqKQqyS2e/agJYEJl78SgpCorI73jewEjWyuwi9r9c6TUF3a21 6f9We5D1fYs6ei855kIQvpOlaGcf+ADMi7qug1f6FORNmOL4UngWDpCyy854YhOpbBie B6AluJBjwJ4t4ziqeKtP7T8NLz+s5JEaQLYg2Zd6s3GEYYtNbulkbz5bGjuOaul+/IPf /O+Q== X-Gm-Message-State: AOAM530EnATmDDy5CnT0gH0JvVylRwBAf3tqAz3bHZiXdFnnJtYTn9B9 ccNr4toRH0OKLH4mGrsnnEk6iX0BVW10KaZxidIiUfeSO5Y= X-Received: by 2002:a1f:f203:: with SMTP id q3mr8867332vkh.1.1632920073828; Wed, 29 Sep 2021 05:54:33 -0700 (PDT) MIME-Version: 1.0 References: <20210928123906.988813-1-colin.king@canonical.com> In-Reply-To: From: Daniel Palmer Date: Wed, 29 Sep 2021 21:56:36 +0900 Message-ID: Subject: Re: [PATCH][next] rtc: msc313: Fix unintentional sign extension issue on left shift of a u16 To: Romain Perier Cc: Colin King , Daniel Palmer , Alessandro Zummo , Alexandre Belloni , Nobuhiro Iwamatsu , linux-arm-kernel , linux-rtc@vger.kernel.org, kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Romain, On Tue, 28 Sept 2021 at 22:55, Romain Perier wrot= e: > > Hi, > > Le mar. 28 sept. 2021 =C3=A0 15:31, Daniel Palmer a =C3= =A9crit : > The crazy stuff being, I ran rtctest from selftests and rtc-range (1) > that tests a variety > of dates including 2038 and 2106 for example. Both tests passed :) (proba= bly > because *this case* specifically did not happen while running the test) I suspect it works because for reading the time because seconds is a u32 not unsigned long like the other functions. So if the high word of the register is read, is promoted to a wider type and sign extended it doesn't actually matter because it gets truncated to 32 bits so the sign extended part is gone. Cheers, Daniel