Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1588980pxp; Sat, 12 Mar 2022 15:07:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAv36CwpeuUatjKKQN+oOmCnfMLXDzuLeXPOBWUmNr1wMUIRBT3om4+MDPAZzD8dmGqIk6 X-Received: by 2002:aa7:9618:0:b0:4f7:a98b:79b6 with SMTP id q24-20020aa79618000000b004f7a98b79b6mr4436944pfg.2.1647126451808; Sat, 12 Mar 2022 15:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647126451; cv=none; d=google.com; s=arc-20160816; b=uhxCDzUiSqVENNx9sh5s6L/7Zul0j1E9b4T1lglAlnClIO2z+Q9AoNCDhvQIiWNLi/ DnLaMEnRMAbQSzN0SlkkxQz0xWLA77ohVhJ6jt8ZlqybcUdBhr+ojhhuPX19khUJeTN1 K7ZIejeAtq7lou/rY64gkpUwt2T30Q310xLtAXgjbl7TO0jm7SHbj6NVrNPO13c0NaWh qQV5jPZg+NOGbb7oXLQi9EiWfLQIMVyZL519iguTJQrzenFsyeyRTKvOcjL8zXmdI1Cj FbDF9ZOpp9otrqzM15mFTEYtlDux/Y9O5vnLciQ8YqpFQTI0c3WNS5OmgJ+KLn7yRxYh Qptw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=vHg87Lf9dvBWlrB/awtWe477mXwsvDm+/Qcqu3QGI80=; b=qC0Xu/nhazR4DzVDdgKFIEY0JTnUEpOTQ2CUGTYs4n7D9UJiGfFagSqUiYaO1kMvkO S1XKQm7C1fc91GVxxr51TeGkXk5B3C9kYme+fPeZhk7gluEQLHGbzBZUyfVdvE5fmi5r RjmF17qDeYM+AyBpYPfY/pZiT4Zv0PXeNDP6kdPy9V/NC1hENJorYRiuIuML42qcuoa9 l42Zy+VdII30oX7c+ZbSVfShWIfvE8a9Xic103EnLr+2JJsvfW8fMrOxQ5lw1uGPLaSz X83YDj0kmI5/H58zVbu8N84IF4xF02jzsjxJaofARWPYbtqvKMKGjTybcfm5z7ENkJr9 gVLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=P88T2Pc7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q197-20020a632ace000000b0038053982d7esi10926199pgq.229.2022.03.12.15.07.18; Sat, 12 Mar 2022 15:07:31 -0800 (PST) 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=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=P88T2Pc7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232301AbiCLRUq (ORCPT + 99 others); Sat, 12 Mar 2022 12:20:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232302AbiCLRUp (ORCPT ); Sat, 12 Mar 2022 12:20:45 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D747EB165 for ; Sat, 12 Mar 2022 09:19:39 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id t2so7908663pfj.10 for ; Sat, 12 Mar 2022 09:19:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vHg87Lf9dvBWlrB/awtWe477mXwsvDm+/Qcqu3QGI80=; b=P88T2Pc7DXzAMOhsmi4ll9qyZi+5Qpj2tcqNVzq4AvE3Btwe59iYCYxfuRIWU/4Uve eSt+8IeuNbi346lYRjc5pjNbZs9QlaNPhqJrRgLL8sTTv0dHf/kfRgnOmNsg7YDmPxwk KTnaxGL460jujbNG59nbcmLiJfJt8dpUQ3Pg8XUPATQvH6TJbUzShvaZwG3lcM65YD9J dUZVAhVIt6fQCKIZNv9mobfxRTiqBM6F4+x+uCbXhdQxRqLkWCyFoObDUTxU+s70GE76 2YiJmulbX34OKn3HR27BxhQR8Da5veWA7SLJGdcbvUi+DIfeFaBRILiVVuMY3FSsyMNR E82g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vHg87Lf9dvBWlrB/awtWe477mXwsvDm+/Qcqu3QGI80=; b=V+kYTM2V5aCRAe/2gVx6JkRH9pknSNeYxh6hzGpbvAkBouIuvnQsg+oTBVjun2eH9d Ld8aPNLm8qOawGtaWdk6PLKoYDYfUz8EaN2H8uHoy4FCUN15AkF0I3SloolV/bE1PFWh FKLTKZeuz++ZDblF+kDf4LUV90nm72eGDtivW/uX6nyEV/pyNfzEPfmxT41QmGzHEYcG yXLmLDP0uEO6cFg8va3Sya4OeG+JKAUnX36trY4iDa0WKWfbD+h+COvTGbO9s3F9/yWF YDI2vKDsXsbKE4zZTe+vAetpu/KtLt6dOLdUonENthLLQN4YtBl9tBsbZzQKY1Z6LyAB mBUw== X-Gm-Message-State: AOAM530cbTiNtt7gIUe28SE0YnTzPbkjgG2pz3s11z6ahxQUthqaIb/Q ldDDA70qHCZU1SkjZ5Z3YyFTVg== X-Received: by 2002:a63:c156:0:b0:37c:9955:ab24 with SMTP id p22-20020a63c156000000b0037c9955ab24mr13289109pgi.90.1647105579096; Sat, 12 Mar 2022 09:19:39 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id e18-20020a056a001a9200b004f759dcd841sm13899457pfv.42.2022.03.12.09.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Mar 2022 09:19:38 -0800 (PST) Date: Sat, 12 Mar 2022 09:19:36 -0800 From: Stephen Hemminger To: Alexander Vorwerk Cc: , , , , , , Subject: Re: [PATCH] net: ipv4: tcp.c: fix an assignment in an if condition Message-ID: <20220312091936.1f8c9289@hermes.local> In-Reply-To: <20220312162744.32318-1-alexander.vorwerk@stud.uni-goettingen.de> References: <20220312162744.32318-1-alexander.vorwerk@stud.uni-goettingen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 On Sat, 12 Mar 2022 17:27:44 +0100 Alexander Vorwerk wrote: > reported by checkpatch.pl > > Signed-off-by: Alexander Vorwerk > --- > net/ipv4/tcp.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c > index 28ff2a820f7c..7fa6e7e6ea80 100644 > --- a/net/ipv4/tcp.c > +++ b/net/ipv4/tcp.c > @@ -959,10 +959,10 @@ static struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int flags, > struct sk_buff *skb = tcp_write_queue_tail(sk); > struct tcp_sock *tp = tcp_sk(sk); > bool can_coalesce; > - int copy, i; > + int copy = size_goal - skb->len; > + int i; > > - if (!skb || (copy = size_goal - skb->len) <= 0 || > - !tcp_skb_can_collapse_to(skb)) { > + if (!skb || copy <= 0 || !tcp_skb_can_collapse_to(skb)) { > new_segment: > if (!sk_stream_memory_free(sk)) > return NULL; Your new code will crash if skb is NULL.