{"id":2232511,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2232511/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260504-fix-sbsa-timeout-overflow-v1-1-87de9b44112f@nokia.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.1/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260504-fix-sbsa-timeout-overflow-v1-1-87de9b44112f@nokia.com>","date":"2026-05-04T09:34:34","name":"[RESEND] watchdog: sbsa_gwdt: clamp WOR value to hw max","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"20eff4e901c64c84dcd1223c40de0ad3e3a82fa2","submitter":{"id":93322,"url":"http://patchwork.ozlabs.org/api/1.1/people/93322/?format=json","name":"Juuso Rinta","email":"juuso.rinta@nokia.com"},"delegate":{"id":1696,"url":"http://patchwork.ozlabs.org/api/1.1/users/1696/?format=json","username":"stroese","first_name":"Stefan","last_name":"Roese","email":"sr@denx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260504-fix-sbsa-timeout-overflow-v1-1-87de9b44112f@nokia.com/mbox/","series":[{"id":502689,"url":"http://patchwork.ozlabs.org/api/1.1/series/502689/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=502689","date":"2026-05-04T09:34:34","name":"[RESEND] watchdog: sbsa_gwdt: clamp WOR value to hw max","version":1,"mbox":"http://patchwork.ozlabs.org/series/502689/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232511/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232511/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=nokia.com header.i=@nokia.com header.a=rsa-sha256\n header.s=selector1 header.b=shTFM8ZC;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=nokia.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=nokia.com header.i=@nokia.com header.b=\"shTFM8ZC\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=nokia.com","phobos.denx.de;\n spf=fail smtp.mailfrom=juuso.rinta@nokia.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g8R4l66nNz1yKC\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 05 May 2026 01:53:11 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 5C4EA845E3;\n\tMon,  4 May 2026 17:52:49 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 8B68983EF9; Mon,  4 May 2026 11:35:09 +0200 (CEST)","from OSPPR02CU001.outbound.protection.outlook.com\n (mail-norwayeastazlp170130007.outbound.protection.outlook.com\n [IPv6:2a01:111:f403:c20f::7])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 6238E80F0E\n for <u-boot@lists.denx.de>; Mon,  4 May 2026 11:35:07 +0200 (CEST)","from DUZPR01CA0254.eurprd01.prod.exchangelabs.com\n (2603:10a6:10:4b5::26) by DB9PR07MB7132.eurprd07.prod.outlook.com\n (2603:10a6:10:1fb::21) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9870.25; Mon, 4 May\n 2026 09:35:04 +0000","from DU2PEPF00028D0E.eurprd03.prod.outlook.com\n (2603:10a6:10:4b5:cafe::3) by DUZPR01CA0254.outlook.office365.com\n (2603:10a6:10:4b5::26) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9870.25 via Frontend Transport; Mon,\n 4 May 2026 09:35:03 +0000","from fihe3nok0735.emea.nsn-net.net (131.228.2.240) by\n DU2PEPF00028D0E.mail.protection.outlook.com (10.167.242.22) with Microsoft\n SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9891.9\n via Frontend Transport; Mon, 4 May 2026 09:35:03 +0000","from updev-hifix-1-5g.devops-fwk.dynamic.nsn-net.net\n (10-175-3-186.he-pi-os-dhn-100.nesc.nokia.net [10.175.3.186])\n by fihe3nok0735.emea.nsn-net.net (Postfix) with ESMTP id 42BF8236AF;\n Mon,  4 May 2026 12:35:03 +0300 (EEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=GeK8Pdlc7mc5FOt359wTKBAVpIdobkbCYaH7xn6rXlFmJYT59oz5UgMic6kpaO0Ez1Piq3cjSg66k6zS6QoakDZQGxk3DMt4aQC3rDJKAufk/VbiBVXMRWSZzKmcskoVGKvdA/G10ta+A3r74iGcroA/LjRLSLiSVqDlpeVA4X73k+64RvxuNxL66IdDjvBHRa19pOW9R5Uj4ni79mHLwlrHAhTKq8X9BiFD6QnQbE2xBKqXCS6ILoegJtO0Kid9zcaDXzoGgc9do+JseH/8O6lVSMgoSHJ3QlZJxZgJqoF3COqqpg5zEmt5UGQzyaCmHfOLopTsVg1yIlQra+rETw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=LBtIFgbf/m2ah1f5EFvkwf3CMtVp/sSaqpbqctyfpcE=;\n b=FxdN2LIZoQhtciNjOvhkOX47vezWvkEThdq2x1dImRA39N4HHxZgGs34itKsqbhFh7j5Cm1EF3ZJl5tISAudjZR35FvacW/cwLG8L/MnsJCC5ENe6eVLxUhk/xpD6wy/QFihWwviGgGwPHjups1+z23oTqy1sf1NzSIkWav/hl++0uE4tRLz1itlTG7vnkO3tfrWiy25SS3wPj5oFZj+bthkF9TyOqLNosUaoYYzVpJPn/3waUqdMn15cRFrN/XTXTLSBKZyk/v+3jO7dhxNu6XS4eHckQgl5Xoo6EupSfWrytYtFMi3y5u0fx3SfIKTDDtvRMewVxy2WXJop+omnQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 131.228.2.240) smtp.rcpttodomain=foss.st.com smtp.mailfrom=nokia.com;\n dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nokia.com;\n dkim=none (message not signed); arc=none (0)","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.com;\n s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=LBtIFgbf/m2ah1f5EFvkwf3CMtVp/sSaqpbqctyfpcE=;\n b=shTFM8ZCQaseFnwEtenr7tk6aglhCMtx0mSE64b9ikEszo9Vl9riqpJesuAoL4asogndUOSt/+zRlNY7l8PXFTSSIefZQCJzoocqAHt8+8g+JGkL80HiphtH2AZBQt7UNaMagQI4S3xRyRUQqdZzmqDCm75ESWYnA3sDAdVQz9BbLG8UhcQoSOuEt0vh85V9wLyaIS4yprslG+eQTeS3CT9hqQgJoFdIcqR71Eldg891L9OAJ/Kp5xR3vyQH2wnN89LFw9IqT4cq5WGxZluHlcjWKTuBrY0vatMR3mEMhQ4gCxgZnP3f79SHCOoxiV3gfGvoenKeIsKb0R+9Zp13Ew==","X-MS-Exchange-Authentication-Results":"spf=pass (sender IP is 131.228.2.240)\n smtp.mailfrom=nokia.com; dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nokia.com;","Received-SPF":"Pass (protection.outlook.com: domain of nokia.com designates\n 131.228.2.240 as permitted sender) receiver=protection.outlook.com;\n client-ip=131.228.2.240; helo=fihe3nok0735.emea.nsn-net.net; pr=C","From":"Juuso Rinta <juuso.rinta@nokia.com>","Date":"Mon, 04 May 2026 12:34:34 +0300","Subject":"[PATCH RESEND] watchdog: sbsa_gwdt: clamp WOR value to hw max","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260504-fix-sbsa-timeout-overflow-v1-1-87de9b44112f@nokia.com>","To":"u-boot@lists.denx.de","Cc":"Peng Fan <peng.fan@nxp.com>, Stefan Roese <stefan.roese@mailbox.org>,\n Tom Rini <trini@konsulko.com>,\n Patrice Chotard <patrice.chotard@foss.st.com>, Yao Zi <me@ziyao.cc>,\n Juuso Rinta <juuso.rinta@nokia.com>","X-Mailer":"b4 0.16-dev","X-Developer-Signature":"v=1; a=ed25519-sha256; t=1777887303; l=1757;\n i=juuso.rinta@nokia.com; s=20260428; h=from:subject:message-id;\n bh=A7/gLgMnLyVuCKj0UGJ3KvvFP0xGj5k3qWSdWY4f1hs=;\n b=sYV/PrsBn6ie0dUKICqSxyb/mKFtAOXnzPsnKbWGyhw4q0wwuXEDskV1Z+Whq1gqkKlSXyRkQ\n hg1Ttkj454PCg0GEg3Uq/CI28tMSsUE1gx/6+db9tPBIoD5+xPukavg","X-Developer-Key":"i=juuso.rinta@nokia.com; a=ed25519;\n pk=CnH7U1WPlQ4t8gHpzhFvPnTjoealqDnbmbLMYEd5GDQ=","X-EOPAttributedMessage":"0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU2PEPF00028D0E:EE_|DB9PR07MB7132:EE_","X-MS-Office365-Filtering-Correlation-Id":"f3843cc2-f4c3-404b-fa6e-08dea9c06baa","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;\n ARA:13230040|36860700016|82310400026|376014|1800799024|56012099003|18002099003;","X-Microsoft-Antispam-Message-Info":"\n tcIXVgUoOuV9w3hyxnDLmDg6H+05v86SfHxPTUKESbwXQ+YuhpcZsSKojkhv0coYQyEuMcoQlHF8LODMKNOtWYnptQH6HD0h1XodDAjWSCFtb8w4rtX9qUumik4UHyhL/b00jD/w9ZPvJkCCt9JLNmVTXffh3kqJfvk0FQq2TC4vWSQJe9Cf3Eg9K8Mgf/INRAI8kNsFS/DBTd/wByjrWGu1n6buLq3pKq4/+0QVg/N/O5XF05dHBK7mK07dALEzr1CDYsjrm/vomH5x4dJANRTwAlFrb0kmauStGeQCnIPnoR+NhF09vEJwVgYwLm95AZEOi0JafomD7EnHWi9DWxDj0fGPTczpdtgqTyNsiEE5x50314m/A9ATuc5agouprQvT6t7bKklP/lR/aEu52td2+AZuEHz7wbB0nioKo45zwiPpgc4fSzSswM7WBt9Ac5uoA16PhpLoVqz5IyavUwJHjEY1d3SfgCIogg6adiFflKvtWPkeC4oBegw72wPwsZ7fGTyQIMOrThO3do65SclbtsMA7GS2dKdhU9ypymcC5OgT83+OkaEdydgxlGWnSKIU3uZH4BWP2jB/aJ2TH2T+5epJE/dCwUMoWyaMST3P5FuftH46Q+BeiPqrp8stZQ32Id/ZifZ66x0+DkTomJguv/wiSk2l9he8bFs/nY92c4qPX3NEbSZBKeYB8XI6A8j/ysnMKg8f7dCrEuU78vpWJ1QHCSZpk/wOF6AV5Fg=","X-Forefront-Antispam-Report":"CIP:131.228.2.240; CTRY:FI; LANG:en; SCL:1; SRV:;\n IPV:CAL; SFV:NSPM; H:fihe3nok0735.emea.nsn-net.net;\n PTR:InfoDomainNonexistent;\n CAT:NONE;\n SFS:(13230040)(36860700016)(82310400026)(376014)(1800799024)(56012099003)(18002099003);\n DIR:OUT; SFP:1101;","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"\n h8bc3r0O5dnLDQ4vGhWWJLA3V8HHzkF/oe4d1g9VNZ4tGTLjKzZdrJJ8CO8ZSW1Ru7UyX0rDxjgZgdYqMgxv5OaXEsoIRFD3MvEwQ+VX0Rv+X9h16Gnr3tnRMTqlB//GWNRz5xCPOaLmDKWKlgcbNiVaqwcMEaOJpw+Osd44nI6Ff8/M37OXc0Oj28VKHMEZI4zbPkPzNx+0UW4qnC4C+cnXCgKKox930F8+vKDaTPe5Ry8Zd7fgtrH6TsPuzHrm/fyzCxuVQkii4gVRL2SAAW1rld/9HBPKR/LD78DEuru10aWAYKk3YIQhlZjo38UTMbkpBMcj/frdqzv8yCt6qd4gNpTtY+K2aAmvDHcnRhs+sqlzvS9CYFzZjhALTH+dmqx4ACq4AoBX+9oAd8nPhYxwkr6al5qsvfE1RG3cAe7FcPwIys0PeOvPG9rmt33X","X-OriginatorOrg":"nokia.com","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"04 May 2026 09:35:03.7293 (UTC)","X-MS-Exchange-CrossTenant-Network-Message-Id":"\n f3843cc2-f4c3-404b-fa6e-08dea9c06baa","X-MS-Exchange-CrossTenant-Id":"5d471751-9675-428d-917b-70f44f9630b0","X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp":"\n TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.240];\n Helo=[fihe3nok0735.emea.nsn-net.net]","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-AuthSource":"\n TreatMessagesAsInternal-DU2PEPF00028D0E.eurprd03.prod.outlook.com","X-MS-Exchange-CrossTenant-FromEntityHeader":"HybridOnPrem","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"DB9PR07MB7132","X-Mailman-Approved-At":"Mon, 04 May 2026 17:52:48 +0200","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"The WOR register is 32 bits, so any tick count exceeding U32_MAX is\ntruncated by writel(). A large requested timeout can wrap to a small\nvalue causing the watchdog to fire sooner than requested.\n\nClamp the calculated value to U32_MAX prior to writing the register so\nover-large requests will be set to the maximum timeout value.\n\nFound by code review.\n\nSigned-off-by: Juuso Rinta <juuso.rinta@nokia.com>\n---\n drivers/watchdog/sbsa_gwdt.c | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\n\n---\nbase-commit: 4433253ecf2041f9362a763bb6cb79960921ac7e\nchange-id: 20260428-fix-sbsa-timeout-overflow-20cf84fa8a6b\n\nBest regards,\n--\nJuuso Rinta <juuso.rinta@nokia.com>","diff":"diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c\nindex 807884c5bc7..3a924cb2b9a 100644\n--- a/drivers/watchdog/sbsa_gwdt.c\n+++ b/drivers/watchdog/sbsa_gwdt.c\n@@ -50,6 +50,7 @@ static int sbsa_gwdt_start(struct udevice *dev, u64 timeout, ulong flags)\n {\n \tstruct sbsa_gwdt_priv *priv = dev_get_priv(dev);\n \tu32 clk;\n+\tu64 tout_wdog;\n \n \t/*\n \t * it work in the single stage mode in u-boot,\n@@ -58,8 +59,13 @@ static int sbsa_gwdt_start(struct udevice *dev, u64 timeout, ulong flags)\n \t * to half value of timeout.\n \t */\n \tclk = get_tbclk();\n-\twritel(clk / (2 * 1000) * timeout,\n-\t       priv->reg_control + SBSA_GWDT_WOR);\n+\n+\t/* if requested timeout overflows, clamp it to u32_max */\n+\ttout_wdog = ((u64)clk * timeout) / (2 * 1000);\n+\tif (tout_wdog > U32_MAX)\n+\t\ttout_wdog = U32_MAX;\n+\n+\twritel(tout_wdog, priv->reg_control + SBSA_GWDT_WOR);\n \n \t/* writing WCS will cause an explicit watchdog refresh */\n \twritel(SBSA_GWDT_WCS_EN, priv->reg_control + SBSA_GWDT_WCS);\n","prefixes":["RESEND"]}