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=-15.2 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,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_1 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 A197DC433B4 for ; Thu, 15 Apr 2021 14:36:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 271D861139 for ; Thu, 15 Apr 2021 14:36:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 271D861139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type: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:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=31XFvGovmwPUJoq+pVrEWGPQe+n3UsHN2fe1FjCqrjA=; b=koJIV5ouU5YI3sr0HY2Yp60yd wpOgPEQTshbWsog3R6Bsy00VQurLiaMnp746cewPYF8J91krqVpsfs0ixez4LgWTOFSL5+v16o/E5 bH3GRmhiWP2ISBR7P2iJeesLYvq/n8c0uetgECYN9XL1VvmSwsd5tUI3gg51gt2qVMk7jQg+ist/6 NWmTNgJExi27vRs5/Q8KD6DnhWwajilknraLtdavXoJefycCdx67je7kKyFy7oHr7272MMGdghdzX PqboDQe354tXAmk/hgJHWLL2UeBGVQMPkLW+bfB0QVXVEQZlJIi9GknIU0X5JJVFiFFIcQpC+LH+l qjSc2YunQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lX353-00GSPk-59; Thu, 15 Apr 2021 14:34:53 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lX34z-00GSPG-8s for linux-arm-kernel@desiato.infradead.org; Thu, 15 Apr 2021 14:34:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=CkWzQJq9qTXR/COElw+2nWhJygfpMk390eJBQixVWfk=; b=OKIYJd42mjfJnrpNU6YSUTwiqI U6PV2tiGeBfyHBasqxZA/zOrRivRI3MgqtdNVLumQo89fvc66CgxApePgLkfwNE+0AeiqAQIgcLU4 poRZgLJXrD8TCyPlLp8KXDgJ0to7MYSYOzBfq6k5JdZDq7NUnnorjDYAAgisMEDEhH6mxYLEwtVoM 4nAaZqWaVAojb9TVHdCi3CoGl58m5hc8Z23DOrgi4M1ey3Z4QvEUOn+Lk/9P5wTGu06JTukNreQLE lG1d+IjIDJ8kXx89tYiW4qzC5T5HwfcFkbVHFIHX/BCl+7XM0xgm1+q0Vy1Yh9PdwVpTWduspIPaw HUkz5Tiw==; Received: from userp2120.oracle.com ([156.151.31.85]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lX34w-008eeh-Kf for linux-arm-kernel@lists.infradead.org; Thu, 15 Apr 2021 14:34:47 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13FEJGow079587; Thu, 15 Apr 2021 14:34:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=CkWzQJq9qTXR/COElw+2nWhJygfpMk390eJBQixVWfk=; b=ejz+nbayBZTs6/DWzcb2fO1Kvs0JJdKB0ekXoRwFa/oZ1l9yX0+xBBvYQajdgJSvMhKd Oia8VCc8V3J5lm+bV5mVTfyR0Y72jbfULD1kwT1ef1o33YvCwz/A290iOJ0lc67tAyhA tOIks3zfDzb0frBB5IBkg346uvRAl/ApqRlwg0UBwwznpEYkqqjkC6ZJqgiEzgsaOaup 6/w0sinwaZmUxA3o1/8TiJQIaZir86RloKC3BGH0vH1KrzmEppWvbpz7n8KvGFAnQBhj yG6/kq9P+FQOjmdJfOUNWLucK2x0uZmsNxok+NKFqDG/Vbhbzbm5ojeV1aSE3e+qHgQW 7w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 37u4nnp29h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Apr 2021 14:34:27 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13FEGXDo130989; Thu, 15 Apr 2021 14:34:26 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 37uny13ksw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Apr 2021 14:34:26 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13FEYJUM018811; Thu, 15 Apr 2021 14:34:23 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 15 Apr 2021 07:34:18 -0700 Date: Thu, 15 Apr 2021 17:34:09 +0300 From: Dan Carpenter To: Colin King Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] net: stmmac: replace redundant comparison with true Message-ID: <20210415143409.GC6021@kadam> References: <20210415083757.1807538-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210415083757.1807538-1-colin.king@canonical.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-IMR: 1 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9955 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104150096 X-Proofpoint-ORIG-GUID: 54ZOchoRvgCtTE-6YcFYiYJqRlTKUTmH X-Proofpoint-GUID: 54ZOchoRvgCtTE-6YcFYiYJqRlTKUTmH X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9955 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1011 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104150096 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210415_073446_849972_07FC9FD6 X-CRM114-Status: GOOD ( 22.84 ) 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: , 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 Thu, Apr 15, 2021 at 09:37:57AM +0100, Colin King wrote: > From: Colin Ian King > > The comparison of the u32 variable queue with <= zero is always true > since an unsigned can never be negative. Replace the conditional > check with the boolean true to simplify the code. The while loop > will terminate because of the zero check on queue before queue is > decremented. > > Addresses-Coverity: ("Unsigned compared against 0") > Signed-off-by: Colin Ian King > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index e3e22200a4fd..6e5b4c4b375c 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -1673,7 +1673,7 @@ static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv) > return; > > err_reinit_rx_buffers: > - while (queue >= 0) { This is an off by one from what the original developer was intending because we're freeing the most recent queue that wasn't allocated. In other words, we're freeing everything that we need to plus *one more thing that we don't need to*. But it's harmless in this case: The better fix would be to make queue an int type and do: while (--queue >= 0) dma_free_rx_skbufs(priv, queue); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel