Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2517341imm; Mon, 24 Sep 2018 05:48:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV60thjhNMqYKTNCS3s1J/7SQhT1iy5GBFZf5SJd1HDe8P5GnSE3ORMTYfE5h0QDO+bPOA0el X-Received: by 2002:a63:4663:: with SMTP id v35-v6mr9461493pgk.178.1537793312932; Mon, 24 Sep 2018 05:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793312; cv=none; d=google.com; s=arc-20160816; b=0pS1tMw2TtHrfJUDt7oaULDh+K03k0idOQouxh6SzSQU2xZgCYOEaiyRLYhmU4CeML tnyYK/7HyB9JTV4bQZe/Dcq6+Qonmp1GmtI3aiSHktEZBUwypmkQswCzmN2URRiCPaV7 aY1mpnK6ekurALJtBaB+EzNa9h/ZMK/Jo1Js48w68l41OUc19aj0x4Aa3EvV17MIhOy7 MYFpW/xg+Eeoifu5dmF+/uaJtJG84Gsczq5go8uVkKjLTf6XDvItjh4+8pSmiE/7sMb5 CHk176/3mtMBGgTsMWeCcfYUCwwtBq9/Uy3E44G8eQoeL59CJf8GHphK1H6jpMwwxRBy 5wpw== 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; bh=qKiYXyFVpGcOiHUlX1jauZ4CDRtmBpeHS1D06Yqzp2c=; b=yQzMJqI6/h7qil2PC3y1bSf9r+dKPTQLwPxEFZAlPdHn9lS6nw9rXZAYzC4nrpDhz7 Sq0uzSWXKbqczLfKanRXgk831dk7k+vaDHvbGsC7ovnYe+p/LAsM2j0ji8IrpZPl3RWw Im7QqVc6N5QciK26JRWMBqmDljoOdFUw83IO1ixUR4/+aNHfk/h73aPgCafnye6iMrk0 ILh3H80dLx1LQnhphR5NjYgbmOyupZiBbwvHa8LSnQIS8r826aeA+yofA7i7FYUYFdNg /RtcRKEMfvajrpHwpTCyXgzs0izDa4gNSWMsPJ+TZQW0PwFg9s+di++//n0aU0fiFJsz BWNQ== ARC-Authentication-Results: i=1; mx.google.com; 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 l21-v6si4587004pgu.271.2018.09.24.05.48.17; Mon, 24 Sep 2018 05:48:32 -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; 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 S2389178AbeIXSqg (ORCPT + 99 others); Mon, 24 Sep 2018 14:46:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59646 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729283AbeIXSqg (ORCPT ); Mon, 24 Sep 2018 14:46:36 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5DEE5109A; Mon, 24 Sep 2018 12:44:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Andrzej Hajda , Thierry Reding , Sasha Levin Subject: [PATCH 4.18 220/235] drm/panel: type promotion bug in s6e8aa0_read_mtp_id() Date: Mon, 24 Sep 2018 13:53:26 +0200 Message-Id: <20180924113125.357350301@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit cd0e0ca69109d025b1a1b6609f70682db62138b0 ] The ARRAY_SIZE() macro is type size_t. If s6e8aa0_dcs_read() returns a negative error code, then "ret < ARRAY_SIZE(id)" is false because the negative error code is type promoted to a high positive value. Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver") Signed-off-by: Dan Carpenter Reviewed-by: Andrzej Hajda Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/20180704093807.s3lqsb2v6dg2k43d@kili.mountain Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c @@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s int ret, i; ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id)); - if (ret < ARRAY_SIZE(id) || id[0] == 0x00) { + if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) { dev_err(ctx->dev, "read id failed\n"); ctx->error = -EIO; return;