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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CEA0C433F5 for ; Thu, 7 Apr 2022 02:17:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbiDGCTC (ORCPT ); Wed, 6 Apr 2022 22:19:02 -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: 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 */