Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6053451iog; Thu, 23 Jun 2022 10:20:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tvW/gXCknoRdtEFcGaEQHRNCsFuyGkvQ1BMPaUJ3Qd3dbKW8KuqCEdMpwoDgxobwQi/WuS X-Received: by 2002:a05:6402:ca6:b0:435:8009:aa37 with SMTP id cn6-20020a0564020ca600b004358009aa37mr12195451edb.183.1656004813439; Thu, 23 Jun 2022 10:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656004813; cv=none; d=google.com; s=arc-20160816; b=LfY4zJuIOIVsqGK77shhsxBJCtSErVRjVSzZBSE/T/bYhIyjHJWJGSCpfRPX2MC1h2 9WBaHtzStP7uV5LCjXyj5CRsxErJjcwPgNSadxg0omPtWbaFTbKMHoqPAG8vfTX2aKWa 9O0HSlZX2PNYD7wbMplHSGah7Hras8fz8mDTW+JyxK+WLHUKIlrY1oAxUfliVE0nFY4E c0K386pB1tGA5ZReZFNjzL2hDSzpY6ilsKSwPsHe0Dr3Grul1Rp4wRhaop2Spaungc0E AZbdDuS/uooVFulJl4+/gF8DpcV/hBcrl1UGXK9dBAxoMFBZAjm56wkII9RbhmUHLEHr wAbw== 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=hk5Pqp0NPZBqDeFp8EjbkC2AyFluAV1Btz49lyAou/c=; b=NfFsb6loQVOEmVxgAnFgDDtWUDWgGzSRQjw/MZt+MXDELsXAxMG4TStaS7YbDddtRq YKD5gYRCbkGqBUQOW97E0WgWRU/IsnLvO3n8mhSWSCl4k5Hqpx/Hrf62yvcwFUR6nUK8 U+VVU/7l3sVJLNyvbcxFlVs+T9OmyUdZUPfHeuZUx3ZXYCtVBBpgz6IwJxOgbZtcKmX2 KaRrXoaHmw9T6alvTmPC53kOuxjB/hEp1SXfVCs4dhFi/bAhdcnAO7zMI8CtI3THRZ3g yqCt+9RE9X6Jiys+acv2AK7CplAQd3vJYTYq4cV+P2ZS8PNV5sArI6Y7tUmTX/Mssh8v dwAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b0VyvENj; 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 cw18-20020a170906479200b00715702f1e9esi26375886ejc.799.2022.06.23.10.19.47; Thu, 23 Jun 2022 10:20:13 -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=b0VyvENj; 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 S231572AbiFWRPa (ORCPT + 99 others); Thu, 23 Jun 2022 13:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233183AbiFWRMi (ORCPT ); Thu, 23 Jun 2022 13:12:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28AC226139; Thu, 23 Jun 2022 09:58:11 -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 ams.source.kernel.org (Postfix) with ESMTPS id AD3C9B8248A; Thu, 23 Jun 2022 16:58:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E578DC3411B; Thu, 23 Jun 2022 16:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656003488; bh=+XWr3PnDyJZMzZIi8Bb+yDWvvAjGFGsoYV1mRzJaXVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b0VyvENjKK+gxXEQXphSXzftD/jEK8Xm4o6/cWST/Ok4lQhp1Cc/KQnuGhw3MLgWA lXLBcnd/IPg846kVnuyZjdal8w4J5k6mF1w+pKNaw7tCcXpLgGotMtqRsAF6LsaIyC HoOt+XMjCYi1+MQTwmBwXbbislRY0uxPG0g+ZQ88= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Chuck Lever , Anna Schumaker , Ben Hutchings Subject: [PATCH 4.9 253/264] xprtrdma: fix incorrect header size calculations Date: Thu, 23 Jun 2022 18:44:06 +0200 Message-Id: <20220623164351.224935058@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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: Colin Ian King commit 912288442cb2f431bf3c8cb097a5de83bc6dbac1 upstream. Currently the header size calculations are using an assignment operator instead of a += operator when accumulating the header size leading to incorrect sizes. Fix this by using the correct operator. Addresses-Coverity: ("Unused value") Fixes: 302d3deb2068 ("xprtrdma: Prevent inline overflow") Signed-off-by: Colin Ian King Reviewed-by: Chuck Lever Signed-off-by: Anna Schumaker [bwh: Backported to 4.9: adjust context] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -75,7 +75,7 @@ static unsigned int rpcrdma_max_call_hea /* Maximum Read list size */ maxsegs += 2; /* segment for head and tail buffers */ - size = maxsegs * sizeof(struct rpcrdma_read_chunk); + size += maxsegs * sizeof(struct rpcrdma_read_chunk); /* Minimal Read chunk size */ size += sizeof(__be32); /* segment count */ @@ -101,7 +101,7 @@ static unsigned int rpcrdma_max_reply_he /* Maximum Write list size */ maxsegs += 2; /* segment for head and tail buffers */ - size = sizeof(__be32); /* segment count */ + size += sizeof(__be32); /* segment count */ size += maxsegs * sizeof(struct rpcrdma_segment); size += sizeof(__be32); /* list discriminator */