From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76A87C35656 for ; Fri, 21 Feb 2020 16:52:24 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57409208C4 for ; Fri, 21 Feb 2020 16:52:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57409208C4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=cip-dev-bounces@lists.cip-project.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E6CED87AF4; Fri, 21 Feb 2020 16:52:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pK5eUJnuS6pB; Fri, 21 Feb 2020 16:52:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id B9DDA84ADE; Fri, 21 Feb 2020 16:52:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A4D85C013E; Fri, 21 Feb 2020 16:52:20 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3B977C013E for ; Fri, 21 Feb 2020 16:52:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2789586475 for ; Fri, 21 Feb 2020 16:52:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dHQnrv5BwAZf for ; Fri, 21 Feb 2020 16:52:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by fraxinus.osuosl.org (Postfix) with ESMTP id 10DAD8634C for ; Fri, 21 Feb 2020 16:52:14 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.70,468,1574089200"; d="scan'208";a="39726110" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 22 Feb 2020 01:52:14 +0900 Received: from marian-VirtualBox.ree.adwin.renesas.com (unknown [10.226.36.164]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 93C2840A35F7; Sat, 22 Feb 2020 01:52:13 +0900 (JST) From: Marian-Cristian Rotariu To: cip-dev@lists.cip-project.org Date: Fri, 21 Feb 2020 16:51:50 +0000 Message-Id: <1582303929-5773-4-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582303929-5773-1-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com> References: <1582303929-5773-1-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com> Subject: [cip-dev] [PATCH v2 4.19.y-cip 03/22] usb: typec: mux: Fix unsigned comparison with less than zero X-BeenThere: cip-dev@lists.cip-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cip-dev-bounces@lists.cip-project.org Sender: "cip-dev" From: YueHaibing commit 4e46f271c37415323f2b650d02ef50c87ff8d092 upstream. The return from the call to fwnode_property_read_u16_array is int, it can be a negative error code however this is being assigned to an size_t variable 'nval', hence the check is always false. Fix this by making 'nval' an int. Detected by Coccinelle ("Unsigned expression compared with zero: nval < 0") Fixes: 96a6d031ca99 ("usb: typec: mux: Find the muxes by also matching against the device node") Signed-off-by: YueHaibing Acked-by: Heikki Krogerus Signed-off-by: Greg Kroah-Hartman Signed-off-by: Marian-Cristian Rotariu --- drivers/usb/typec/mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index 0c4e0b5..e49c138 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -126,7 +126,7 @@ static void *typec_mux_match(struct device_connection *con, int ep, void *data) { const struct typec_altmode_desc *desc = data; struct typec_mux *mux; - size_t nval; + int nval; bool match; u16 *val; int i; -- 2.7.4 _______________________________________________ cip-dev mailing list cip-dev@lists.cip-project.org https://lists.cip-project.org/mailman/listinfo/cip-dev