lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230207044603.1011555-2-george.cherian@marvell.com>
Date:   Tue, 7 Feb 2023 04:46:03 +0000
From:   George Cherian <george.cherian@...vell.com>
To:     <wim@...ux-watchdog.org>, <linux@...ck-us.net>,
        <zhangshaokun@...ilicon.com>
CC:     <linux-watchdog@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        "George Cherian" <george.cherian@...vell.com>
Subject: [PATCH 2/2] watchdog: sbsa_wdog: Make sure to program a larger timeout value

There could be a corner case were-in the timeout value calculated will
become way to less than the calculated value since we are rounding down
the timeout value from 64-bit to 32-bit. To avoid hitting such cases,
make sure to program the timeout value to be UINT_MAX if the timeout
value is greater than UINT_MAX and the imeplementation is sbsa watchdog
revision 0.

Fixes: abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")

Signed-off-by: George Cherian <george.cherian@...vell.com>
---
 drivers/watchdog/sbsa_gwdt.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index aaa3f5631f29..028e450ed547 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -135,10 +135,14 @@ static u64 sbsa_gwdt_reg_read(struct sbsa_gwdt *gwdt)
 
 static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt)
 {
-	if (gwdt->version == 0)
-		writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR);
-	else
+	if (gwdt->version == 0) {
+		if (val > UINT_MAX)
+			writel(UINT_MAX, gwdt->control_base + SBSA_GWDT_WOR);
+		else
+			writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR);
+	} else {
 		lo_hi_writeq(val, gwdt->control_base + SBSA_GWDT_WOR);
+	}
 }
 
 /*
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ