From patchwork Sun Apr 17 17:10:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12815999 X-Patchwork-Delegate: kuba@kernel.org 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 CC7D8C433F5 for ; Sun, 17 Apr 2022 17:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234599AbiDQRNK (ORCPT ); Sun, 17 Apr 2022 13:13:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231211AbiDQRNI (ORCPT ); Sun, 17 Apr 2022 13:13:08 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67FFE63F8 for ; Sun, 17 Apr 2022 10:10:32 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id u5-20020a17090a6a8500b001d0b95031ebso5233384pjj.3 for ; Sun, 17 Apr 2022 10:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=84VJQi/2/yPzYKLQB3UGdKxxnh2pxi0liokf2t3z3C0=; b=eco7xcTdvKRBSg2qoFtNgyiwQHCMRe9+wAUO0NshNhp1/TcM61VSGXJz56qX0GP31Q jxRKTwMNRevDRxNlueIvr52IZNXHyrMIDVrLytOUeFysYhjOw9MK66LLArsLXHjyeogE XLLTOmdggvsP0OJlQAbFCJAJHY5TMKKGWuSE5C+kQgcMvXJPtOmcIDHt2qCIxxkSLkPe zEIv1Jr3C7IZDEfGzQo5X57FBuHz/xywXXKcW/ijOcIYwDxI5H3xf24tzOgRhIjBJO24 7d8aXkY02ng4e1AMTAunmV7eT4Jppn1lpQHR4xOlq+3xpbqYLWNpyYf07vLiC3dIR4cd FGKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=84VJQi/2/yPzYKLQB3UGdKxxnh2pxi0liokf2t3z3C0=; b=ClD6vN76Put2yiL13prDbnjgPdR52fxoRScdwzAO1hKycSXYg5iIK4Nf9JULZhbvy7 6zI57OOaDTgO2kTks7oxDMoKJ/d/IC9RDKWQpc2Kyt7zmqssKYfAL2XErbuuOOL14vf0 TDijHUZ121cBZCrZZKIrN170bDMVYwSkbvlW7mK65CfEDvzb+2ffMz74FjCPw99To1zp aFLYDPh0almeLZ8bVwrnA7H8qICzy0stoE57n/WlIknE9zaBcX764FNBOlOnKB4OWAyx bgyVj5/f2EBrFshHp4o5lRgrZgrA5kaegDvAjFq+bdTMJCqDuTnltDKnzPQYaibh/YaK pSzw== X-Gm-Message-State: AOAM533aUoIh9mTG8e96Shz06/uCCaNgreyHrEoVDYkzrqK3f+xvjTtY yh1sJFcDEiV9rpimLmGJt7M= X-Google-Smtp-Source: ABdhPJzT2unK0fz+s2wvT6Sdz1BDgqGiAOyhuIvyWamDH0KUFb59Nlb/IJsVxH2P2ABvVKDbR4bcLg== X-Received: by 2002:a17:902:d709:b0:155:d473:2be0 with SMTP id w9-20020a170902d70900b00155d4732be0mr7360311ply.151.1650215431625; Sun, 17 Apr 2022 10:10:31 -0700 (PDT) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:2a7a:266f:bc8e:11ae]) by smtp.gmail.com with ESMTPSA id c16-20020a631c50000000b003a39244fe8esm5861312pgm.68.2022.04.17.10.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:10:31 -0700 (PDT) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: netdev , Eric Dumazet , Eric Dumazet , kernel test robot Subject: [PATCH net-next] tcp: fix signed/unsigned comparison Date: Sun, 17 Apr 2022 10:10:27 -0700 Message-Id: <20220417171027.3888810-1-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Kernel test robot reported: smatch warnings: net/ipv4/tcp_input.c:5966 tcp_rcv_established() warn: unsigned 'reason' is never less than zero. I actually had one packetdrill failing because of this bug, and was about to send the fix :) Fixes: 4b506af9c5b8 ("tcp: add two drop reasons for tcp_ack()") Signed-off-by: Eric Dumazet Reported-by: kernel test robot --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index cf2dc19bb8c766c1d33406053fd61c0873f15489..0d88984e071531fb727bdee178b0c01fd087fe5f 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5959,7 +5959,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) step5: reason = tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT); - if (reason < 0) + if ((int)reason < 0) goto discard; tcp_rcv_rtt_measure_ts(sk, skb);