Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp574953img; Fri, 22 Mar 2019 04:21:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqywRZ/UuEXbqdSQk98VLwm2rfJnKAWWPJjU6U+hK+KeKTDLOEhXbY7jmy1F1GQoItPLP+aP X-Received: by 2002:a62:1346:: with SMTP id b67mr8834991pfj.195.1553253663295; Fri, 22 Mar 2019 04:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253663; cv=none; d=google.com; s=arc-20160816; b=Y5Z6+H9l4QnREj59wwbV1KK41TjeSS92XmhndpIGJPiaPCjFCoGdoIaoHJm/LTdE5l QHeR9+hCmgtrgWm27pcA1YKNF6tpIG1RK+4ydHwsYDv+AIIGzI8meBnjfX9ciX4VWtTO bwTss6fkSeHomZ6q5nKT7GBegbd3dEu4y/nnJO6hueMFbv1vjI6bzVZKbVpCufX05ugv ulRzsvvtp/L00nScYQSRkMwc71vH4oBzvaA39f/eOrVPx8qbWEeBUErRDDcEpKC4Kdng KSxpLDDovTNTyBo6YYgZTgXoSLvU1zCJWUVYUyI6mmOXD0O1nAAWaKi8eu2IcikGX+gB Srqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jpQBUfu3X/mOS7NwVR99VdFQ8MNH2/Q5/IDDYPobPPw=; b=mv78TlRZwY9ZylhpSMe400vc/h43X4oBCrBo3ZCiyagWEfqpGw71HyOHTdPu6o4bk1 6uVakvVqb9TRfOE8x4cCmSRZoiXHIdXvUxiUoZG3Ne6ePgSMsvNtlahJEA7CGuL1Q5ge +/TW89HqC48bh88HUNeZBjSMsL8JbmNMptreTULQwYA/jBUpcwzA6RpcEu3382YSFlYO TnYZYEl74krAwh1xEAXQGkvXXipjcmvNbtfFLwdbLMZiARrje4ezukBDaR+HbwhSM/CN xpL2AugjzLTYGuqQewAqBdCK7E5N5xeXxNTJ+6z9UVFLwxifVuSvfaAE4lUoIAg+RI5P RnBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="LFmW/9VS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si6394938pgh.447.2019.03.22.04.20.47; Fri, 22 Mar 2019 04:21:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="LFmW/9VS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728267AbfCVLT6 (ORCPT + 99 others); Fri, 22 Mar 2019 07:19:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:46354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728096AbfCVLT4 (ORCPT ); Fri, 22 Mar 2019 07:19:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CB871218A2; Fri, 22 Mar 2019 11:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253595; bh=2QgRpHCP+8kVTAcbhq7ZeQTGAE971k7liuOBCb8vntI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LFmW/9VSC3YjXDaOmo0c5KGnaFeJfLvMgqXSbNmzC/5jlysTO/lkUx+50rQvq9mcN rJsuMIZAvnpbhoiDxzdgiHZoENb6v+oYpm+7lQon+W0Z63BW9Ua9IhD5akWYyqiRe3 tNZF8NfAxtRzV63A4YcK619t7sfswdmAz6KsvUGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , Jacek Anaszewski , Sasha Levin Subject: [PATCH 3.18 016/134] leds: lp5523: fix a missing check of return value of lp55xx_read Date: Fri, 22 Mar 2019 12:13:49 +0100 Message-Id: <20190322111211.183960476@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 Signed-off-by: Jacek Anaszewski Signed-off-by: Sasha Levin --- 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 9e1716f8098ca..20e43f8b93256 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