Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1943645rwo; Thu, 3 Aug 2023 02:11:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+H7/yLouDSWenetuvriFbbyKmFclDJBj+WM+MawdZnCz0I9ksFYvRpffzphQVEfJ3ZMNR X-Received: by 2002:a17:906:3f54:b0:99b:d6f5:afee with SMTP id f20-20020a1709063f5400b0099bd6f5afeemr7289818ejj.23.1691053896678; Thu, 03 Aug 2023 02:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691053896; cv=none; d=google.com; s=arc-20160816; b=alNhwLiTv2U03juC1Ew2aaBIscTK5rjJ5ytvgIhUT5zX2hts29xhnWqXK4BoZWUOwd DxUk77TO2xh9ksfWw3WYEJPh0U8i4eFRMIm3OCLCBOC3unu5Y1jssfa9av/YtFOCgfu1 CzbiGLMfV08nP2kxXPu7H/BpKaJADQr+Gl6PcQUhRNnw2QFdqY40h1bwL0pewRWiQDdo GRYAumULv6AdmJzDC1wDu+v17jE87KpwLGIrt3TxVsl1LNHJIY7wQ2r8MLYXNQ1H30Hb 45BzCBaKVkm7X5ZvH1COecpvbUJG+jj/rfYs2uLKJ8zovt9oUvpgxjWpygZiAGvmP+NH NL8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BgDZdKVYtYBC5Xi+0BBUdQW4/LqOnmYQ8PU41nUVpZ8=; fh=g4n3kYZBmOeg2a46+B592BIoi41Yn7fFOGMt8Xc4pcU=; b=VSlbyTV3lJAHR6hEA45G9h9Ts1FWqwlZtKG+iojCiF6/qq/7LCCLBMatOJOuD0+ZRO xZYmTOEXY0WeDJl03lrCQliYVsB3Zadegp+fbXQ4T8Qbx4uxu8BT+9swRDU2O9eRnk8u 7Bf/b+dl5eIZNWSXZ/XHBftEaEQoyv+Nf8LoPP7Ps6gefbzmBmz7pdafBFOoB7lTktrk p9h18+pq/XLTshq2iOP89SViR0FCO5x+JfOc+5L+zIjJz3WH0wbXRPeb9DSFB+lD9Dnm 3q9cDTWoIQ20rtHTwtymKPh9xNGa+4blkYGWhdjAWjg0Fs8mRfxOaMTfiG6r3reuJcfZ VUJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a1709062b4300b0098932a90cdasi11927571ejg.255.2023.08.03.02.11.12; Thu, 03 Aug 2023 02:11:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234729AbjHCIsO (ORCPT + 99 others); Thu, 3 Aug 2023 04:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233982AbjHCIsJ (ORCPT ); Thu, 3 Aug 2023 04:48:09 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6773FC; Thu, 3 Aug 2023 01:48:06 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R981e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VoyDIp8_1691052474; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VoyDIp8_1691052474) by smtp.aliyun-inc.com; Thu, 03 Aug 2023 16:48:03 +0800 From: Jiapeng Chong To: gregkh@linuxfoundation.org Cc: andriy.shevchenko@linux.intel.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] 8250_men_mcb: Fix unsigned comparison with less than zero Date: Thu, 3 Aug 2023 16:47:53 +0800 Message-Id: <20230803084753.51253-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The data->line[i] is defined as unsigned int type, if(data->line[i] < 0) is invalid, so replace data->line[i] with res. ./drivers/tty/serial/8250/8250_men_mcb.c:223:6-19: WARNING: Unsigned expression compared with zero: data->line[i] < 0. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6088 Signed-off-by: Jiapeng Chong --- drivers/tty/serial/8250/8250_men_mcb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_men_mcb.c b/drivers/tty/serial/8250/8250_men_mcb.c index 5f301195575d..c27c52d18dfa 100644 --- a/drivers/tty/serial/8250/8250_men_mcb.c +++ b/drivers/tty/serial/8250/8250_men_mcb.c @@ -222,11 +222,13 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, + data->offset[i]; /* ok, register the port */ - data->line[i] = serial8250_register_8250_port(&uart); - if (data->line[i] < 0) { + res = serial8250_register_8250_port(&uart); + if (res < 0) { dev_err(&mdev->dev, "unable to register UART port\n"); - return data->line[i]; + return res; } + + data->line[i] = res; dev_info(&mdev->dev, "found MCB UART: ttyS%d\n", data->line[i]); } -- 2.20.1.7.g153144c