lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250206132538.GU554665@kernel.org>
Date: Thu, 6 Feb 2025 13:25:38 +0000
From: Simon Horman <horms@...nel.org>
To: Peter Seiderer <ps.report@....net>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Shuah Khan <shuah@...nel.org>
Subject: Re: [PATCH net-next v4 09/17] net: pktgen: align some variable
 declarations to the most common pattern

On Wed, Feb 05, 2025 at 02:11:45PM +0100, Peter Seiderer wrote:
> Align some variable declarations (in get_imix_entries and get_labels) to
> the most common pattern (int instead of ssize_t/long) and adjust function
> return value accordingly.
> 
> Signed-off-by: Peter Seiderer <ps.report@....net>

Hi Peter,

These comments are is true in general of this patchset, but particularly so
in the case of this patch:

* I think a more succinct subject would be nice.
* I think the patch description should provide some reason
  _why_ the change is being made.

Also, specifically relating to this patch, I wonder if it's scope ought to
be extended. For example, the two callers of num_arg(), get_imix_entries() and
pktgen_if_write() assign the return value of num_arg() to len, which is now
an int in both functions. But num_args() returns a long.

> ---
> Changes v3 -> v4
>   - new patch (factored out of patch 'net: pktgen: fix access outside of user
>     given buffer in pktgen_if_write()')
> ---
>  net/core/pktgen.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 4f201a2db2dc..279910367ad4 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -850,12 +850,11 @@ static int strn_len(const char __user * user_buffer, unsigned int maxlen)
>   * where each entry consists of size and weight delimited by commas.
>   * "size1,weight_1 size2,weight_2 ... size_n,weight_n" for example.
>   */
> -static ssize_t get_imix_entries(const char __user *buffer,
> -				struct pktgen_dev *pkt_dev)
> +static int get_imix_entries(const char __user *buffer,
> +			    struct pktgen_dev *pkt_dev)
>  {
> -	int i = 0;
> -	long len;
>  	char c;
> +	int i = 0, len;

Given it can be achieved with exactly the same lines changed, just in a
different order, please arrange the local variable declarations in reverse
xmas tree order - longest line to shortest.

Likewise for the other hunk of this patch.  And I believe there are also
other cases in this patchset where this comment applied.

The following tool can be useful:
https://github.com/ecree-solarflare/xmastree

...

-- 
pw-bot: changes-requested

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ