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: <OSAPR01MB75673C9BF3232C94E34D994CE3059@OSAPR01MB7567.jpnprd01.prod.outlook.com>
Date:   Fri, 4 Mar 2022 03:17:40 +0000
From:   Shangyan Zhou <sy.zhou@...mail.com>
To:     Leon Romanovsky <leon@...nel.org>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH] rdma: Fix res_print_uint()

I'm also confused by the uint64 and %d at first. Since I encounter this problem on a 32-bit hw_counter, I thought it may assumed the input val is 32-bit.

I checked that the _color_ variant for u64 does exist, and changed my commit.

I'm a newbie to submit patch by email, I replied this email and found it created a new patch. I don't know if it is the right way. if I'm wrong, please let me know. 

Thanks!

-----Original Message-----
From: Leon Romanovsky <leon@...nel.org> 
Sent: Friday, March 4, 2022 2:44 AM
To: Shangyan Zhou <sy.zhou@...mail.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] rdma: Fix res_print_uint()

On Wed, Mar 02, 2022 at 11:06:41AM +0800, Shangyan Zhou wrote:
> Print unsigned int should use "%u" instead of "%d"
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@...mail.com>
> ---
>  rdma/res.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rdma/res.c b/rdma/res.c
> index 21fef9bd..832b795d 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -214,7 +214,7 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
>  	if (!nlattr)
>  		return;
>  	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
> -	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
> +	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %u ", val);

val is uint64_t, so the more correct change will need to use print_u64(...) and "%"PRIu64 instead of %u/%d, but I don't know if _color_ variant exists for *_u64.

Thanks

>  }
>  
>  RES_FUNC(res_no_args,	RDMA_NLDEV_CMD_RES_GET,	NULL, true, 0);
> --
> 2.20.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ