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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 B6CA3C48BE6 for ; Wed, 16 Jun 2021 19:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8ECFB6008E for ; Wed, 16 Jun 2021 19:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232257AbhFPTEl (ORCPT ); Wed, 16 Jun 2021 15:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232246AbhFPTEj (ORCPT ); Wed, 16 Jun 2021 15:04:39 -0400 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83D53C061574; Wed, 16 Jun 2021 12:02:33 -0700 (PDT) Received: by mail-oi1-x22e.google.com with SMTP id x196so3592574oif.10; Wed, 16 Jun 2021 12:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:reply-to:references :mime-version:content-disposition:in-reply-to; bh=UOqLQQmsoCxqiYwODGOxvwScag2+ijPfJja63uXJkvM=; b=QKlM7nFUoB6J9K6LCVtW4wLxrfvSkz/9/nDxNyxDziZoJE7UBptRchMsuVPPsv/Hh6 0hoMsU+kE/siiKIoEARnj+zwFE8PmjgdODBmhLSDyKIQnUHb5mT7rlhid2dRz4RZKI/1 vm4AD/ORdZWtQjEHXa03hMC9KsTCZM+Vu+kDID2Vzbbo1Zy1tCzn9xoJLK9bGpIWQ0M3 X/Hvi9oD4cMfRkNHQ7PZvIQb4wcnbP5lJsan/SoaGrXV6dn7us3t/odsNRmWZL50gXrH tXos9ISMyX0/UUW/opRzLItk0oDWUNvFsoT4dfNaFMLJ19g29AeyElaIe2MR1hrrlcVG VX5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-disposition:in-reply-to; bh=UOqLQQmsoCxqiYwODGOxvwScag2+ijPfJja63uXJkvM=; b=YjQa/OCv5374ugRtSavGSg4napRZ+R8w1mZCMf1GlOKAX1HqqGmKzaGgAP6yuaQZ84 NLc4/HNkE7lcI4qFBnu2CHCYKyCDRuFG/3s3b1mc5QM2qPj1KeOrA0RK28XSEr8kpEhR uJh4MuKQMWSiAaEdhpBtJ+0xudJwL7b274TxG+vFTJ+3+t63n3hEd65t582NWX/FRsRg n89gIhHedEG1lKIEvmcIcNNZ13BBovkluzy+zLG5VOi322HIETfiga/XUt1Vv4nJDTkz qxL9gGE5N2hRywsxm1STMzpLik7VIrzFoQLjJAz6ebKqgmJEtb1UhS+Clgaat9vZHStM fXGA== X-Gm-Message-State: AOAM532GWQGENa4VIQL0ajb7t0MT5/Q/H+RaKo7TeCdiPpJWewSNaSbK faNajjUkyFhR/zCdGYXDBg== X-Google-Smtp-Source: ABdhPJzogjBWC3Po3+HvkfTYzT7IZOBBIi2tfx6vpj5GURwwDUR39OAgLN+pokD5M0qf1LT+kBQ+bQ== X-Received: by 2002:aca:281a:: with SMTP id 26mr8138043oix.142.1623870152808; Wed, 16 Jun 2021 12:02:32 -0700 (PDT) Received: from serve.minyard.net ([47.184.156.158]) by smtp.gmail.com with ESMTPSA id p9sm694118otl.64.2021.06.16.12.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:02:31 -0700 (PDT) Sender: Corey Minyard Received: from minyard.net (unknown [IPv6:2001:470:b8f6:1b:742a:6ad4:30ea:e332]) by serve.minyard.net (Postfix) with ESMTPSA id B2FF61800E7; Wed, 16 Jun 2021 19:02:30 +0000 (UTC) Date: Wed, 16 Jun 2021 14:02:29 -0500 From: Corey Minyard To: Colin King Cc: Joel Stanley , Andrew Jeffery , openipmi-developer@lists.sourceforge.net, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] ipmi: kcs_bmc_aspeed: Fix less than zero comparison of a unsigned int Message-ID: <20210616190229.GG2921206@minyard.net> Reply-To: minyard@acm.org References: <20210616162913.15259-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210616162913.15259-1-colin.king@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 05:29:13PM +0100, Colin King wrote: > From: Colin Ian King > > The comparisons of the unsigned int hw_type to less than zero always > false because it is unsigned. Fix this by using an int for the > assignment and less than zero check. Thanks, I added this to my tree. -corey > > Addresses-Coverity: ("Unsigned compared against 0") > Fixes: 9d2df9a0ad80 ("ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration") > Signed-off-by: Colin Ian King > --- > drivers/char/ipmi/kcs_bmc_aspeed.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c > index 0401089f8895..92a37b33494c 100644 > --- a/drivers/char/ipmi/kcs_bmc_aspeed.c > +++ b/drivers/char/ipmi/kcs_bmc_aspeed.c > @@ -301,13 +301,15 @@ static inline int aspeed_kcs_map_serirq_type(u32 dt_type) > static int aspeed_kcs_config_upstream_irq(struct aspeed_kcs_bmc *priv, u32 id, u32 dt_type) > { > unsigned int mask, val, hw_type; > + int ret; > > if (id > 15) > return -EINVAL; > > - hw_type = aspeed_kcs_map_serirq_type(dt_type); > - if (hw_type < 0) > - return hw_type; > + ret = aspeed_kcs_map_serirq_type(dt_type); > + if (ret < 0) > + return ret; > + hw_type = ret; > > priv->upstream_irq.mode = aspeed_kcs_irq_serirq; > priv->upstream_irq.id = id; > -- > 2.31.1 > 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=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 9A202C48BE6 for ; Wed, 16 Jun 2021 19:04:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 5E06B611CE for ; Wed, 16 Jun 2021 19:04:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E06B611CE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8usZKNAEe14IBtbYm5ETWeo9k81fTCm/zp2rnpJ+PQs=; b=1Ak4AbPDJ3m/ha yIaStubxowR/oXv1VKYByECHwVupapAvEwcL4Gu+0oiwJ6ZYbnupEoMdpTe1fmw+LggT8yJNfSkrh a0JubmOQs1v+0Aq73UmYwxT65zBkpAlwvEi0UMgIEz76blI7WnmbAdrrcZkikVmjONvMHrUsoLzt+ kICNCGthlZK/dkqyePP7m85zMUOykwOJfXgqQjVtc7uZ6EhayV0jbpa7tmscleVeRwwKhDsJo5bMD FRn+I6jyx78XuYBiSG6cf8wQJt/W4gefb31My17k7kIUzNLa6zpgWeNXxfad5m2Hge+il6VHe3WaT y0qsPuWztTUlTqza89IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltaoA-007UUt-Ss; Wed, 16 Jun 2021 19:02:39 +0000 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltao6-007UT3-Jx for linux-arm-kernel@lists.infradead.org; Wed, 16 Jun 2021 19:02:35 +0000 Received: by mail-oi1-x22c.google.com with SMTP id m137so3613693oig.6 for ; Wed, 16 Jun 2021 12:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:reply-to:references :mime-version:content-disposition:in-reply-to; bh=UOqLQQmsoCxqiYwODGOxvwScag2+ijPfJja63uXJkvM=; b=QKlM7nFUoB6J9K6LCVtW4wLxrfvSkz/9/nDxNyxDziZoJE7UBptRchMsuVPPsv/Hh6 0hoMsU+kE/siiKIoEARnj+zwFE8PmjgdODBmhLSDyKIQnUHb5mT7rlhid2dRz4RZKI/1 vm4AD/ORdZWtQjEHXa03hMC9KsTCZM+Vu+kDID2Vzbbo1Zy1tCzn9xoJLK9bGpIWQ0M3 X/Hvi9oD4cMfRkNHQ7PZvIQb4wcnbP5lJsan/SoaGrXV6dn7us3t/odsNRmWZL50gXrH tXos9ISMyX0/UUW/opRzLItk0oDWUNvFsoT4dfNaFMLJ19g29AeyElaIe2MR1hrrlcVG VX5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-disposition:in-reply-to; bh=UOqLQQmsoCxqiYwODGOxvwScag2+ijPfJja63uXJkvM=; b=uJHHWac5d8SOZx9MbLV2ecBJzl25w6FGqMHal9DETfz8tsltkJC0sHjYEcwPu+xSee u3oZadh2zzrG7Xr2KOEv5qiEABGoy+Sy1IWfHfSwjbSLkwidEMOfZe85pN/FBDyz7RuO HGlaIGBb7KlHU+mHcpWvBdlNEM/QBP2YUADWslPjKbc0INdxkMQ/qslN1aCRvMl12vLx xXWyyui3viIhgilDMecqS33/OyAl8uKTNtT+FnlNHH8+VZfCDno62VhFBT98rz3/mzAE fO5VNDYZb7mAN6r/nd9pk/ojMgGHGagO2AvWpUcZaKVx/U6a7iwm950NJwQqp5nAUN+W eLWg== X-Gm-Message-State: AOAM530vzwKxvENmZdMB2ucDACc0nOK8CgGUja2oe+mXebdh3ekvahlU ItboPGnlqWc6PMb2FxFbeQ== X-Google-Smtp-Source: ABdhPJzogjBWC3Po3+HvkfTYzT7IZOBBIi2tfx6vpj5GURwwDUR39OAgLN+pokD5M0qf1LT+kBQ+bQ== X-Received: by 2002:aca:281a:: with SMTP id 26mr8138043oix.142.1623870152808; Wed, 16 Jun 2021 12:02:32 -0700 (PDT) Received: from serve.minyard.net ([47.184.156.158]) by smtp.gmail.com with ESMTPSA id p9sm694118otl.64.2021.06.16.12.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:02:31 -0700 (PDT) Received: from minyard.net (unknown [IPv6:2001:470:b8f6:1b:742a:6ad4:30ea:e332]) by serve.minyard.net (Postfix) with ESMTPSA id B2FF61800E7; Wed, 16 Jun 2021 19:02:30 +0000 (UTC) Date: Wed, 16 Jun 2021 14:02:29 -0500 From: Corey Minyard To: Colin King Cc: Joel Stanley , Andrew Jeffery , openipmi-developer@lists.sourceforge.net, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] ipmi: kcs_bmc_aspeed: Fix less than zero comparison of a unsigned int Message-ID: <20210616190229.GG2921206@minyard.net> References: <20210616162913.15259-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210616162913.15259-1-colin.king@canonical.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210616_120234_720179_71CDE64D X-CRM114-Status: GOOD ( 18.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: minyard@acm.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 16, 2021 at 05:29:13PM +0100, Colin King wrote: > From: Colin Ian King > > The comparisons of the unsigned int hw_type to less than zero always > false because it is unsigned. Fix this by using an int for the > assignment and less than zero check. Thanks, I added this to my tree. -corey > > Addresses-Coverity: ("Unsigned compared against 0") > Fixes: 9d2df9a0ad80 ("ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration") > Signed-off-by: Colin Ian King > --- > drivers/char/ipmi/kcs_bmc_aspeed.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c > index 0401089f8895..92a37b33494c 100644 > --- a/drivers/char/ipmi/kcs_bmc_aspeed.c > +++ b/drivers/char/ipmi/kcs_bmc_aspeed.c > @@ -301,13 +301,15 @@ static inline int aspeed_kcs_map_serirq_type(u32 dt_type) > static int aspeed_kcs_config_upstream_irq(struct aspeed_kcs_bmc *priv, u32 id, u32 dt_type) > { > unsigned int mask, val, hw_type; > + int ret; > > if (id > 15) > return -EINVAL; > > - hw_type = aspeed_kcs_map_serirq_type(dt_type); > - if (hw_type < 0) > - return hw_type; > + ret = aspeed_kcs_map_serirq_type(dt_type); > + if (ret < 0) > + return ret; > + hw_type = ret; > > priv->upstream_irq.mode = aspeed_kcs_irq_serirq; > priv->upstream_irq.id = id; > -- > 2.31.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel