Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1099190rdb; Mon, 19 Feb 2024 04:26:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0x9PJFXv8xkHGXSEGj7BxzAiV60mbcNZPnc0zBiyzLL5TDlqGKpzkGtsi3vKsW4mMVP9GVbtZnnZz8mvf+yb1PODQEPI/aINWRxW6tw== X-Google-Smtp-Source: AGHT+IEWlkR128B2qJwVHbco8AtxWZupKnCz4EQ3AjvY/Uz15HXn1XdG0W+eU3a+NxLMbou4BBgG X-Received: by 2002:a05:6a00:2f81:b0:6e4:688e:2072 with SMTP id fm1-20020a056a002f8100b006e4688e2072mr1154606pfb.34.1708345565095; Mon, 19 Feb 2024 04:26:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708345565; cv=pass; d=google.com; s=arc-20160816; b=kw81/8vQOga70MaxVuIEgluSm/r5z3PCpRQh5TsVKO1IpKiJ6uQE6GTCuSksfzo9P8 CqrnAdo1aE5jZ+W7R5ebTclZ0wLCU86JYh9uAFOWuULqSsdxf3m6tOgIsZdFwbaLkhzP FHPZHO6hc2SHho4uNWlnHqzDXwPxPCclk1iepEQ53Fz2RvVCZd4FCUfwK3kLUnu5mx60 LBhJBrITSG4JRXwXXPqxsJlwhzrao5kVI2LTnc3/SLriPPe8HRGDFRa3/0Dm/VwcWVpX 1mRuEfKO/7sUlT7NxWunNJ0Al7FN4M1x67kUafqHCg6lNKzyYrliwj2R02pvNbk5sXjS qViw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:dkim-signature:message-id; bh=DkVT2jDCTEiEB3I4q1MvWvXu2gwGeHJQocWwFjbYXGE=; fh=rSQT/JDFVPs9rHIywdHVC3EoMk0kA85I/K520id+RX8=; b=PN1hOa7gZjGV/n+tNIEHNoHqC6l8BIP3bMb6QWgX7DSlRZi+i3woH1CPCzP7VmOL1M fU0+wYqsmdVZ7xNro8uUw/8NeNROqWxbgMGRWMMrtoBx8Pfa1IanoWtWhDo+vIyTNLkH iJ12nUstr3T4GCsXfugGL7G0q5EeOkTlrgA7FXlkSDnW9+FwYA1VeMV7zK0WfRPzuBdR B88l/AewDNYm0bmsJyO12SrDSL16RZLlMA5YgdxsSuquhTOBKYDLQ3BitqdtWuZsaTcc J+60bMbX1+PSCorBuyu4tT2zttiKqpvApDYoU7rJbS3whWs2Ha0+RZVrs0uP4b3WekCT /ZvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=CaIe+yC3; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71295-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id by8-20020a056a00400800b006e302dd06aasi3782606pfb.66.2024.02.19.04.26.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 04:26:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71295-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=CaIe+yC3; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71295-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6BE8EB2352A for ; Mon, 19 Feb 2024 12:19:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 647522D61A; Mon, 19 Feb 2024 12:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="CaIe+yC3" Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C547028DDA for ; Mon, 19 Feb 2024 12:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708345177; cv=none; b=qv5TxbCJgWwgdT7BgxZaY8ltxEowgZf0ljPNPPmVnUCfIoBFZsrR24C2+ZMG/8QQW96HniHk95mm5WnZfdE00XQSlIy42F0IGnrBo7Ltsf5VwPM74RnIf31yZfnCjHHLdtfoWsmPmUEhtjhi13NLSluXIjrxiD3MvS3y+r1GXy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708345177; c=relaxed/simple; bh=XZhHjRkTj6nAHd5DH2JdWTq2TlG6374TlIGjtVi+DOg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uxnhKVFVyEoy7W0zqXrkszLKObSxNi73mpO7DczR/d1p4mrzNPFrPf28KggHngTTTQQ72cLdZkrvjyZEoY5MXmxQl9ueCLFElnBvY7Ey0/IwLzym49F3dLXRBZzCyIl7GqbpbmSxhMvOzhA822tY1w0vHT7cn8i0y+dN4acp/Ew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=CaIe+yC3; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <99e3e994-ef6a-4339-abf2-cda62d24b1ce@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708345173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DkVT2jDCTEiEB3I4q1MvWvXu2gwGeHJQocWwFjbYXGE=; b=CaIe+yC3VWWsIwDtdZDwlDmoJQpk6KwmTKHJjMIbgk2ALrL3MJOcJRTs0xk71hAcD0iHcs rG4whUuljZj/jHmsTTZ0T6Pk/ZKRszUCWxxxHZ0EzOS7Isofz+m+i+9m2jq/REDPQQ3xss 45FxfJFgIskFkV4+58egD+GIeT71+/4= Date: Mon, 19 Feb 2024 20:19:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] net/mlx5: fix possible stack overflows To: Hamdan Agbariya , Arnd Bergmann , Arnd Bergmann , Saeed Mahameed , Leon Romanovsky Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yevgeny Kliteynik , Alex Vesker , Netdev , "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20240213100848.458819-1-arnd@kernel.org> <84874528-daea-424d-af63-b9b86835fae6@linux.dev> <2ebe5a36-ce81-4d26-a12b-7affbd65c5e3@app.fastmail.com> <11f40993-ec02-48b7-aec5-13ff7cddf665@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 2024/2/19 17:05, Hamdan Agbariya 写道: >> 在 2024/2/15 16:03, Arnd Bergmann 写道: >>> On Thu, Feb 15, 2024, at 01:18, Zhu Yanjun wrote: >>>> 在 2024/2/13 18:08, Arnd Bergmann 写道: >>>>> static int >>>>> -dr_dump_rule_rx_tx(struct seq_file *file, struct mlx5dr_rule_rx_tx >>>>> *rule_rx_tx, >>>>> +dr_dump_rule_rx_tx(struct seq_file *file, char *buff, >>>>> + struct mlx5dr_rule_rx_tx *rule_rx_tx, >>>>> bool is_rx, const u64 rule_id, u8 format_ver) >>>>> { >>>>> struct mlx5dr_ste *ste_arr[DR_RULE_MAX_STES + >>>>> DR_ACTION_MAX_STES]; @@ -533,7 +532,7 @@ >> dr_dump_rule_rx_tx(struct seq_file *file, struct mlx5dr_rule_rx_tx >> *rule_rx_tx, >>>>> return 0; >>>>> >>>>> while (i--) { >>>>> - ret = dr_dump_rule_mem(file, ste_arr[i], is_rx, rule_id, >>>> Before buff is reused, I am not sure whether buff should be firstly >>>> zeroed or not. >>> I don't see why it would, but if you want to zero it, that would be a >>> separate patch that is already needed on the existing code, which >>> never zeroes its buffers. >> >> Sure. I agree with you. In the existing code, the buffers are not zeroed. >> >> But to a buffer which is used for several times, it is good to zero it before it is >> used again. >> >> Can you add a new commit with the following? >> >> 1). Zero the buffers in the existing code >> > > No need to zero the buffers, as it does not have any necessity and it will only affect performance. > Thanks, Sorry. I can not get your point. Can you explain why no need to zero the buffers? Thanks in advance. > Hamdan > > > > >> 2). Add the zero functionality to your patch If a buffer is used for many times, is it necessary to zero it before it is used again? Thanks, Zhu Yanjun >> >> From my perspective, it is good to the whole commit. >> >> Please Jason and Leon comment on this. >> >> Thanks, >> >> Zhu Yanjun >> >>> >>> Arnd