From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Kangjie Lu <kjlu@umn.edu>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Sasha Levin <sashal@kernel.org>,
linux-leds@vger.kernel.org
Subject: [PATCH AUTOSEL 3.18 13/14] leds: lp5523: fix a missing check of return value of lp55xx_read
Date: Tue, 12 Feb 2019 21:41:37 -0500 [thread overview]
Message-ID: <20190213024139.22268-13-sashal@kernel.org> (raw)
In-Reply-To: <20190213024139.22268-1-sashal@kernel.org>
From: Kangjie Lu <kjlu@umn.edu>
[ Upstream commit 248b57015f35c94d4eae2fdd8c6febf5cd703900 ]
When lp55xx_read() fails, "status" is an uninitialized variable and thus
may contain random value; using it leads to undefined behaviors.
The fix inserts a check for the return value of lp55xx_read: if it
fails, returns with its error code.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/leds/leds-lp5523.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 9e1716f8098c..20e43f8b9325 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -313,7 +313,9 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip)
/* Let the programs run for couple of ms and check the engine status */
usleep_range(3000, 6000);
- lp55xx_read(chip, LP5523_REG_STATUS, &status);
+ ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
+ if (ret)
+ return ret;
status &= LP5523_ENG_STATUS_MASK;
if (status != LP5523_ENG_STATUS_MASK) {
--
2.19.1
next prev parent reply other threads:[~2019-02-13 2:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-13 2:41 [PATCH AUTOSEL 3.18 01/14] mfd: ti_am335x_tscadc: Use PLATFORM_DEVID_AUTO while registering mfd cells Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 02/14] mfd: twl-core: Fix section annotations on {,un}protect_pm_master Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 03/14] mfd: db8500-prcmu: Fix some section annotations Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 04/14] mfd: ab8500-core: Return zero in get_register_interruptible() Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 05/14] mfd: wm5110: Add missing ASRC rate register Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 06/14] mfd: mc13xxx: Fix a missing check of a register-read failure Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 07/14] MIPS: ath79: Enable OF serial ports in the default config Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 08/14] scsi: qla4xxx: check return code of qla4xxx_copy_from_fwddb_param Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 09/14] scsi: isci: initialize shost fully before calling scsi_add_host() Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 10/14] MIPS: jazz: fix 64bit build Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 11/14] isdn: i4l: isdn_tty: Fix some concurrency double-free bugs Sasha Levin
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 12/14] atm: he: fix sign-extension overflow on large shift Sasha Levin
2019-02-13 2:41 ` Sasha Levin [this message]
2019-02-13 2:41 ` [PATCH AUTOSEL 3.18 14/14] isdn: avm: Fix string plus integer warning from Clang Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190213024139.22268-13-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=jacek.anaszewski@gmail.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.