Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp806415rdb; Thu, 15 Feb 2024 16:45:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVLDE/e+QBPlnWIS8LAgLxjeSpzC0CSAP0SjZqrxwMxPAvO3ZzkU4Fx0JreDipWobV49RA5leEaenUfeZz4PkX3LsXkWjrPordPqxdP5Q== X-Google-Smtp-Source: AGHT+IGCqGBGRtfpMCM3pST9v2YUSK0QlmctF9ru0yHU+4jk83VvdqqGJpXI3CXZRVEgY9CClbOd X-Received: by 2002:a05:6a20:9c8d:b0:1a0:77ef:f203 with SMTP id mj13-20020a056a209c8d00b001a077eff203mr4705437pzb.6.1708044325295; Thu, 15 Feb 2024 16:45:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708044325; cv=pass; d=google.com; s=arc-20160816; b=c0AKiWqThM3hfyWzdEn5Oy9WUw/vs/0eifehgvni8cggdIpRGhXQWJmA8G8LQU9TDM sS4zfldzWn6E6sLOEOpzFD8Rid8VsI2HlAiIGoTbXQ+ZVjdd6UJ9Ite8VS/gJQFahkQ1 gQAYBiF/Wd38weMcReo+9zLUvBAZh4iG+iR3K82Z3Df9UESdr+6ME59NUaaew7yF07bY 1eefptI4M/TrQB2zgFtxp6h5RmlGMEc3F8qgBzkAHySmSa3J7OEh0ZF/s++3+bQHEnmC qFx5iQ1MaBwyc0WF5VQl9v1MYkrjMqZyks/1iDNeMqDuu9iT3sNlHi7qNljbbg5z9l+N WcKQ== 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=KlOE/QHrK685/cBSEGlCbbuAZty4HqZtwl2hI0O+jio=; fh=3VF6EuCtPJKUG5W4wrB9Qb1cIioNx+1gz5AEWN3e7jo=; b=04k0clOgKEp1Q1CQqnbzjrr2W+Pebf5b28iwsO5oqjuFGzlKtf/g19oD/zbo+9O1fF PHLf3lGJSef0JKhXTbu+SWtCgq8Vwt65tjJN5DPdCi+CT9dhd8mqe1KlzD6WsZer3/4j /VtPnFPAye5rv/WPCfXshj9uhCe7cNtRNFtuDHRlqGyG+LpGasXRkiLNH61SBaTIoAov KK6R/SFME+mHCqu2Z1HNgGaHMsDLEDbbhSA2w7n8cTDEFWa9oOFj17u6cbdJvtKaa6Ip DL0cjQSlJ3RF5FL6O7dsUbEfPw9fHlVOcHvU23mZ8t8n0ddij0ltFyGUyISvbebqTUm9 s3pQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=tv+itwG+; 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-67903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id nw7-20020a17090b254700b00296fc31a361si2077284pjb.66.2024.02.15.16.45.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 16:45:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=tv+itwG+; 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-67903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67903-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7FABD281939 for ; Fri, 16 Feb 2024 00:45:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66ED0DDC5; Fri, 16 Feb 2024 00:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="tv+itwG+" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 BF838BE5E for ; Fri, 16 Feb 2024 00:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708044212; cv=none; b=me7/lTWmG7orZxHBjcOgU+kUyu1ZREUXFmMQcnn6ita2Bt+7BN4tFGOSr6EJbhRTDhslITNImdiO9fxhqIQyFM1iXQTHtJGyFRIqydRzE3QdyqJEDoKS3jaqm1whAWm8pLgNbwj8HQAIL1RT/HRne+OZaQfRETx6tkMxmFNa50I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708044212; c=relaxed/simple; bh=2+VZnPCSYNk+2pPRyl152ePQ0FX0U8JpHjxax5vPuDY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jnrngTpin+KnKq7wsuF66te5L6MQXzs4lxpnfJKN7CxIbLh4j3M1KydveMUcq067e7PcQIyOgPKKrwwCsgo8HM2scm5IcTjXHUSY/g2z/rOFIDrk1MfXgZC0BjOqCZSbKwWoiBeDrOVrfKJhfKXQLi2g722Y1MuIhRIL16PTD5I= 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=tv+itwG+; arc=none smtp.client-ip=91.218.175.182 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: <11f40993-ec02-48b7-aec5-13ff7cddf665@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708044208; 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=KlOE/QHrK685/cBSEGlCbbuAZty4HqZtwl2hI0O+jio=; b=tv+itwG+azGIKJ3yf3N8V0VgYXvjLKRlNl497rfWJd7CpaqicNRKY2qiWipQT1saJxVnNj 2ET24KwQQh84jFd/9tAmCflA3IxxlWQjPSdARAYSJ60kbx98IfUNBRGbzk4elELkgj2qCQ sFSGpacZdFq7hENHEjQbYTByzwIXDV0= Date: Fri, 16 Feb 2024 08:43:18 +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: Arnd Bergmann , Arnd Bergmann , Saeed Mahameed , Leon Romanovsky Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yevgeny Kliteynik , Alex Vesker , Hamdan Igbaria , 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> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: <2ebe5a36-ce81-4d26-a12b-7affbd65c5e3@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 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 2). Add the zero functionality to your patch From my perspective, it is good to the whole commit. Please Jason and Leon comment on this. Thanks, Zhu Yanjun > > Arnd