Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp24204pxh; Thu, 7 Apr 2022 12:51:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu2G9ot9Uj/a12UgOVzT4gj3ex+p/nse8q4wRP3qs0FjCJq3AfxG2yUuqSMlGbNmsCZNlg X-Received: by 2002:a05:6a00:8c5:b0:4fe:134d:30d3 with SMTP id s5-20020a056a0008c500b004fe134d30d3mr15867569pfu.3.1649361079965; Thu, 07 Apr 2022 12:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649361079; cv=none; d=google.com; s=arc-20160816; b=Yx24NQAh6cxgf1pizqRGH6eSJfCRIegamC4s+4nMoCtHUlx7Rio5aFLS0COh2SCajD 7KYpdK0xeo+PTKW49sGkBYH9LayhUkAunYhl1iU7UBQqcw6CF2U0oo/MKIXtrx3/yH3B 20eQcki5vup0xnSUfV0uHKrsgZI3BYDbXA4wpgaJmqBFwD9r2sbbhjmGF5S2Khv880pu OhycTQMqN4htSL95RpMVLL4dxe+F2hMpo80s509g01+Yfd3EEKoRUSjAO0/OwqI5JUQG H0M4TBSz1ZRXDF23FrvPVCMXoxYVeaSR+2W+0mt6dBQ2+e4lsaOt39WinwU+oi8a3BOJ Y34g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ShUf4hLS+tch76BtNsU3YegeRKDb96cV2diCfEUjrkY=; b=ZXbd9XWZkOr0jLWBvtQYyFC/6yXxRCEbfj1SbGnftQ9SuJBdn8gLgC5OaYg7+WReGk RhDOeo5oA7/Bvms6/3UaHlTleNdeNmUGVzNGmUaIDUHGNwQhxOKeQHg8v2wUHPuWErhZ Ul0cF9Rvpu4QvnNyYpZcrQ6IItZhXPdVxprrhBwMwjZI7CCUPZlkM/KWZbB7UE8TfNRR gEZTgdQUbXB2Hux/4OMktPgEwIwss4lGgGUajsjY8UZMy9xF2D034XGDEKdVzESZ6eND wL/L3pNL0D/k9xoBxyZ6yrFh5/5nLsG63WzPR0WJuhr2396SfdloQDDE5pvdIsYb4icU ftHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=U1NkePxP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h66-20020a636c45000000b00398ab411828si18746440pgc.604.2022.04.07.12.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 12:51:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=U1NkePxP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7DBCC26C549; Thu, 7 Apr 2022 12:22:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232758AbiDGCTB (ORCPT + 99 others); Wed, 6 Apr 2022 22:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbiDGCS5 (ORCPT ); Wed, 6 Apr 2022 22:18:57 -0400 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5377F94C6; Wed, 6 Apr 2022 19:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649297818; x=1680833818; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=llF4ThJA8WXHbpmx9IR7QlE6waiGypoC/axSTEFWsaU=; b=U1NkePxPQ8xO6B2xi3K/Mb6zofXd2B0gxKhi3GMCS/mx0Zaca7FyWL81 v2O0IvNeVz2K9HRTkmEmbGbeDGPypV2J+7ei/zesjMo1oyncdLZsYg7fN l8aOk8WLinlKb1lIVQkzArN53/cRqPqbQkRlr3TWzUqn7QIj/qv6VqvSU tQ7hWNEwAmI4LD4w2yty2uzBE/I1MyoIj0B0D3y1xSjP39ujysMCRLila D4N+XFD7qjMP59DNx8UUjLQaRTRFkOUHWCuPQ45wJclZvbx046AhMfy7g xifkikx9k6gMUvyKNKvE3UhXqW/bar6L77I47sgH4hyTAWJZquRscfjSs Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="321901648" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="321901648" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:16:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="524183462" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.135]) by orsmga002.jf.intel.com with ESMTP; 06 Apr 2022 19:16:56 -0700 Date: Thu, 7 Apr 2022 10:09:35 +0800 From: Xu Yilun To: Tom Rix Cc: Marco Pagani , Moritz Fischer , Wu Hao , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fpga: altera-pr-ip: fix unsigned comparison with less than zero Message-ID: <20220407020935.GA256292@yilunxu-OptiPlex-7050> References: <20220405185349.220607-1-marpagan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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 On Wed, Apr 06, 2022 at 07:18:21AM -0700, Tom Rix wrote: > > On 4/5/22 11:53 AM, Marco Pagani wrote: > > Fix the "comparison with less than zero" warning reported by > > cppcheck for the unsigned (size_t) parameter "count" of the > > "alt_pr_fpga_write()" function. > > > > Signed-off-by: Marco Pagani > > --- > > drivers/fpga/altera-pr-ip-core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/fpga/altera-pr-ip-core.c b/drivers/fpga/altera-pr-ip-core.c > > index be0667968d33..2ff3d8e46a0c 100644 > > --- a/drivers/fpga/altera-pr-ip-core.c > > +++ b/drivers/fpga/altera-pr-ip-core.c > > @@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf, > > u32 *buffer_32 = (u32 *)buf; > > size_t i = 0; > > - if (count <= 0) > > + if (count == 0) > > return -EINVAL; > > Reviewed-by: Tom Rix Acked-by: Xu Yilun > > > /* Write out the complete 32-bit chunks */