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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3bf85637ed244052a26f03cc42cf8f12@amazon.com>
Date: Tue, 15 Jul 2025 11:52:22 +0000
From: "Arinzon, David" <darinzon@...zon.com>
To: "kuba@...nel.org" <kuba@...nel.org>, "mkubecek@...e.cz" <mkubecek@...e.cz>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"ant.v.moryakov@...il.com" <ant.v.moryakov@...il.com>
Subject: RE: [PATCH ethtool] netlink: fix missing headers in text output

> The commit under fixes added a NULL-check which prevents us from
> printing text headers. Conversions to add JSON support often use:
> 
>   print_string(PRINT_FP, NULL, "some text:\n", NULL);
> 
> to print in plain text mode.
> 
> Correct output:
> 
>   Channel parameters for vpn0:
>   Pre-set maximums:
>   RX:           n/a
>   TX:           n/a
>   Other:                n/a
>   Combined:     1
>   Current hardware settings:
>   RX:           n/a
>   TX:           n/a
>   Other:                n/a
>   Combined:     0
> 
> With the buggy patch:
> 
>   Channel parameters for vpn0:
>   RX:           n/a
>   TX:           n/a
>   Other:                n/a
>   Combined:     1
>   RX:           n/a
>   TX:           n/a
>   Other:                n/a
>   Combined:     0
> 
> Fixes: fd328ccb3cc0 ("json_print: add NULL check before jsonw_string_field() in print_string()")
> Signed-off-by: Jakub Kicinski mailto:kuba@...nel.org
> ---
>  json_print.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/json_print.c b/json_print.c
> index 4f61640392cf..e07c651f477b 100644
> --- a/json_print.c
> +++ b/json_print.c
> @@ -143,10 +143,11 @@ void print_string(enum output_type type,
>         } else if (_IS_FP_CONTEXT(type)) {
>                 if (value)
>                         fprintf(stdout, fmt, value);
> +               else
> +                       fprintf(stdout, fmt);
>         }
>  }
> 
> -
>  /*
>   * value's type is bool. When using this function in FP context you can't pass
>   * a value to it, you will need to use "is_json_context()" to have different
> -- 
> 2.50.1

Thanks for identifying the issue and proposing the fix.

Reviewed-by: David Arinzon <mailto:darinzon@...zon.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ