From nobody Mon Jun 8 22:54:21 2026 Received: from mta.al2klimov.de (mta.al2klimov.de [162.55.223.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6E4D3C0621 for ; Tue, 26 May 2026 06:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.55.223.79 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779776028; cv=none; b=gjd5bVNrsqiB63J+qL31zH5ScP+8LI02QkTVOV3kwqk0BJBjBoTbtsHGTXlzlseCRlzb5Jl3P8nxDJnwFqWnrLGBWWHYBPkrp6mgJDrM9e8ztzEJfy3G0Vzq1xGbGQn4H4+DJ9eu2CxUOZ8aWoR1WxizNg7FAlqjDCwYSoLWKfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779776028; c=relaxed/simple; bh=ahw0jNpEFvc8GI7zwsXehzNE5glnq9D77tDxuRb5Hhs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fQxH2tJo0FX0zGKRd52lAw3f+8CGq4sH0CkUNoDalxhvdSe4ChhSEnYZ0D4LI/uWqcn70ZsOgbvW2Wt7J9LbsOcpdgw7T0sHhO692fendn7P7Jr8pnNHJqL0ZNsC9eUU9s+Yaf9mq6dG39YdrBVddQx3oz09eA9ZSwKb7f6pNnY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=al2klimov.de; spf=pass smtp.mailfrom=al2klimov.de; dkim=pass (2048-bit key) header.d=al2klimov.de header.i=@al2klimov.de header.b=aFAdYdu4; arc=none smtp.client-ip=162.55.223.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=al2klimov.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=al2klimov.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=al2klimov.de header.i=@al2klimov.de header.b="aFAdYdu4" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=default; bh=ahw0jNpEFvc8 GI7zwsXehzNE5glnq9D77tDxuRb5Hhs=; h=references:in-reply-to:date: subject:cc:to:from; d=al2klimov.de; b=aFAdYdu4HiZ7tVfqbsHTQ/0boPv4Zts0 qd5dq+m0RAxdSE5DesvnAApdKrI8L8Sok0rKmlAEvtTFqJ2EYf18LUw5yLKzC3PH9kBCf3 ils19bwuGDrkQePp7SuXZRwav1DgUW2o/nXt6aqNMRoGdW0BcFJB3l7gTWZYsyOAU9qlDb uTTPizzszcAeGzspMVhBU6kVmlqLTY2zNOSKkJi52YQn7tqyRHTR4XS9VrKo90J/Jlbl3V +NhDRYy4mOCuLNAnhYUtD5BGFrgW4cHCJRAntr7QrGpgmMh7M74r9KFr95dPfyRbQn3EPw B8wrQLKN1HKGFYy9xWEa45Q97D7KMQ== Received: from cachy-ak (88.215.123.80.dyn.pyur.net [88.215.123.80]) by mta.al2klimov.de (OpenSMTPD) with ESMTPSA id 0cd98f73 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Tue, 26 May 2026 06:13:41 +0000 (UTC) From: "Alexander A. Klimov" To: Mark Gross , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , linux-kernel@vger.kernel.org (open list) Cc: "Alexander A. Klimov" Subject: [PATCH] tlclk: if sscanf() fails, fall back to 0, not random value Date: Tue, 26 May 2026 08:13:15 +0200 Message-ID: <20260526061321.6123-4-grandmaster@al2klimov.de> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260526061321.6123-1-grandmaster@al2klimov.de> References: <20260526061321.6123-1-grandmaster@al2klimov.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If sscanf(IN, FMT, &OUT) fails, OUT may be unchanged. So if OUT was never initialized, it may be still uninitialized memory. To prevent such, initialize OUT=3D0 first. Fixes: 648bf4fb21f5 ("[PATCH] tlclk driver update") Fixes: 1a80ba882730 ("[PATCH] Telecom Clock Driver for MPCBL0010 ATCA compu= ter blade") Signed-off-by: Alexander A. Klimov --- drivers/char/tlclk.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 677d230a226c..1d0fcf87449d 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c @@ -327,7 +327,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static ssize_t store_received_ref_clk3a(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -349,7 +349,7 @@ static DEVICE_ATTR(received_ref_clk3a, (S_IWUSR|S_IWGRP= ), NULL, static ssize_t store_received_ref_clk3b(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -371,7 +371,7 @@ static DEVICE_ATTR(received_ref_clk3b, (S_IWUSR|S_IWGRP= ), NULL, static ssize_t store_enable_clk3b_output(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -393,7 +393,7 @@ static ssize_t store_enable_clk3a_output(struct device = *d, struct device_attribute *attr, const char *buf, size_t count) { unsigned long flags; - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; =20 sscanf(buf, "%lX", &tmp); @@ -414,7 +414,7 @@ static ssize_t store_enable_clkb1_output(struct device = *d, struct device_attribute *attr, const char *buf, size_t count) { unsigned long flags; - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; =20 sscanf(buf, "%lX", &tmp); @@ -436,7 +436,7 @@ static ssize_t store_enable_clka1_output(struct device = *d, struct device_attribute *attr, const char *buf, size_t count) { unsigned long flags; - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; =20 sscanf(buf, "%lX", &tmp); @@ -457,7 +457,7 @@ static ssize_t store_enable_clkb0_output(struct device = *d, struct device_attribute *attr, const char *buf, size_t count) { unsigned long flags; - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; =20 sscanf(buf, "%lX", &tmp); @@ -478,7 +478,7 @@ static ssize_t store_enable_clka0_output(struct device = *d, struct device_attribute *attr, const char *buf, size_t count) { unsigned long flags; - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; =20 sscanf(buf, "%lX", &tmp); @@ -499,7 +499,7 @@ static ssize_t store_select_amcb2_transmit_clock(struct= device *d, struct device_attribute *attr, const char *buf, size_t count) { unsigned long flags; - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; =20 sscanf(buf, "%lX", &tmp); @@ -540,7 +540,7 @@ static DEVICE_ATTR(select_amcb2_transmit_clock, (S_IWUS= R|S_IWGRP), NULL, static ssize_t store_select_amcb1_transmit_clock(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -582,7 +582,7 @@ static DEVICE_ATTR(select_amcb1_transmit_clock, (S_IWUS= R|S_IWGRP), NULL, static ssize_t store_select_redundant_clock(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -603,7 +603,7 @@ static DEVICE_ATTR(select_redundant_clock, (S_IWUSR|S_I= WGRP), NULL, static ssize_t store_select_ref_frequency(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -624,7 +624,7 @@ static DEVICE_ATTR(select_ref_frequency, (S_IWUSR|S_IWG= RP), NULL, static ssize_t store_filter_select(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -644,7 +644,7 @@ static DEVICE_ATTR(filter_select, (S_IWUSR|S_IWGRP), NU= LL, store_filter_select); static ssize_t store_hardware_switching_mode(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -665,7 +665,7 @@ static DEVICE_ATTR(hardware_switching_mode, (S_IWUSR|S_= IWGRP), NULL, static ssize_t store_hardware_switching(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -686,7 +686,7 @@ static DEVICE_ATTR(hardware_switching, (S_IWUSR|S_IWGRP= ), NULL, static ssize_t store_refalign (struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned long flags; =20 sscanf(buf, "%lX", &tmp); @@ -705,7 +705,7 @@ static DEVICE_ATTR(refalign, (S_IWUSR|S_IWGRP), NULL, s= tore_refalign); static ssize_t store_mode_select (struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 @@ -725,7 +725,7 @@ static DEVICE_ATTR(mode_select, (S_IWUSR|S_IWGRP), NULL= , store_mode_select); static ssize_t store_reset (struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - unsigned long tmp; + unsigned long tmp =3D 0; unsigned char val; unsigned long flags; =20 --=20 2.54.0