Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413143rwa; Tue, 23 Aug 2022 04:29:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR6j6Qj8Y1u8s+znJbocYHyR0+esHHA0mizvhpYRvHW9lC5bDjVM55ibG7K9JJeL/1Tnfsm/ X-Received: by 2002:a63:1841:0:b0:429:8268:1fc with SMTP id 1-20020a631841000000b00429826801fcmr20466360pgy.78.1661254163567; Tue, 23 Aug 2022 04:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254163; cv=none; d=google.com; s=arc-20160816; b=fBYrHi7ZBJ8rc11IVoDm66SUqlBCuTexNVtk8OULVlEZkd0Y7Dd1/fcPtiftUa+R+e XDQgQmjqofDZ835K2BdGsAAquwh3wOcryLzURqPA2VosCi4/JcyE26yObgTH9/q60IK+ Gh4L8ws1aSTKyeEPT/H9RYVyEAXV9UlRIcQgYcsQRHkwW1w5IDTHE4ojGwkp8o30VvXM dFwHlo9pS/zdg+N6MgPhuz0o4MlEbTOtxEjROCrX8cKViVsS3bfsUmVyXXUqOVmR/qwx Iyo/7+lNuUg5wGJ/PiJDXrySMzl8hhj2nDIZeygyeuFJHYpI5pZFc74rMddijfY9283f zYhQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ubcz2qOrfqGu8tPbmttiQjWl7Kidm0QOn9EBv9razl0=; b=i3aWeYg/YKROhazyHMJmivrxpKGhf2kKxJJpUucTv8m7MbkKpxYFmktTU7A5+UGJLd FC/N1pqT4mScgPbYj8/Tgtp3XUL5knIMcMruDuYnxx7OPDZ1enqf/6bswEuGDbhSh8Og YDLP9RFponncG9g5428gIRJZb5pqNC6JdmGPkXHjii8dkKUk/ir3O3Vj2UoaNxscMxyK gwmH+L5YQQ7Oev11XVetCZ8TwNKecJhGqwjuvvsFdYZp5lZuh5q7enVDGBRJK78IeIQ2 N5BlpzHUOO98VzyhjiNr9epROwTBGSwRnvJzwAYYWYrhnFCjr/zdV84XH1dMZg9qt1Rj 1PAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kjWsgpKb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 10-20020a63020a000000b0041d01162decsi15469562pgc.630.2022.08.23.04.29.12; Tue, 23 Aug 2022 04:29:23 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kjWsgpKb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356305AbiHWKlu (ORCPT + 99 others); Tue, 23 Aug 2022 06:41:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354616AbiHWK22 (ORCPT ); Tue, 23 Aug 2022 06:28:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC39D84EF5; Tue, 23 Aug 2022 02:06:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 0AFAACE1B55; Tue, 23 Aug 2022 09:06:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22568C433B5; Tue, 23 Aug 2022 09:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245566; bh=1HheMQ0rOndr83yFbEnl+ikT2KqMkrmBSB+eHXVVNvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kjWsgpKbN3dv3t5SsAnMdd3KDN9u3R51r1Ou/oDZdKpuZCi8IotC0fPVdHfY6aFEE 9V1SB7c0P/ID8XhO+CZVMU9aIWeSNv16xyfWa9iD+MiJ3dlDC+VXUkM8JmnjfA9glk eAX7wuW1/1YWOITrmSZmIaKaFRkvzCbRqPSSXt9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Xu Yilun , Marco Pagani , Sasha Levin Subject: [PATCH 4.19 119/287] fpga: altera-pr-ip: fix unsigned comparison with less than zero Date: Tue, 23 Aug 2022 10:24:48 +0200 Message-Id: <20220823080104.389848938@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Marco Pagani [ Upstream commit 2df84a757d87fd62869fc401119d429735377ec5 ] 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. Fixes: d201cc17a8a3 ("fpga pr ip: Core driver support for Altera Partial Reconfiguration IP") Reviewed-by: Tom Rix Acked-by: Xu Yilun Signed-off-by: Marco Pagani Link: https://lore.kernel.org/r/20220609140520.42662-1-marpagan@redhat.com Signed-off-by: Xu Yilun Signed-off-by: Sasha Levin --- 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 65e0b6a2c031..059ba27f3c29 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) return -EINVAL; /* Write out the complete 32-bit chunks */ -- 2.35.1