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: <1509730361-23905-3-git-send-email-akshay.bhat@timesys.com>
Date:   Fri,  3 Nov 2017 13:32:41 -0400
From:   Akshay Bhat <akshay.bhat@...esys.com>
To:     a.zummo@...ertech.it, alexandre.belloni@...e-electrons.com
Cc:     linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Akshay Bhat <akshay.bhat@...esys.com>
Subject: [PATCH 3/3] rtc: rx8010: Fix for incorrect return value

The err variable is not being reset after a successful read. Explicitly
reset err variable to account for all return paths.

Reported-by: Jens-Peter Oswald <oswald@....de>
Signed-off-by: Akshay Bhat <akshay.bhat@...esys.com>
---
 drivers/rtc/rtc-rx8010.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 2e06e5f..1ce2078 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -223,6 +223,7 @@ static int rx8010_init_client(struct i2c_client *client)
 					    2, ctrl);
 	if (err != 2)
 		return err < 0 ? err : -EIO;
+	err = 0;
 
 	if (ctrl[0] & RX8010_FLAG_VLF)
 		dev_warn(&client->dev, "Frequency stop was detected\n");
@@ -261,6 +262,7 @@ static int rx8010_read_alarm(struct device *dev, struct rtc_wkalrm *t)
 	err = i2c_smbus_read_i2c_block_data(client, RX8010_ALMIN, 3, alarmvals);
 	if (err != 3)
 		return err < 0 ? err : -EIO;
+	err = 0;
 
 	flagreg = i2c_smbus_read_byte_data(client, RX8010_FLAG);
 	if (flagreg < 0)
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ