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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9e397d55-34bd-3df7-57cc-e5726198bb97@gmail.com>
Date:   Fri, 11 Sep 2020 09:25:05 +0200
From:   "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
To:     Alejandro Colomar <colomar.6.4.3@...il.com>
Cc:     mtk.manpages@...il.com, linux-man@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/24] stat.2: Remove unneeded cast

On 9/10/20 11:13 PM, Alejandro Colomar wrote:
> Both major(3) and minor(3) return an 'unsigned int',
> so there is no need to use a 'long' for printing.
> Moreover, it should have been 'unsigned long',
> as "%lx" expects an unsigned type.

See my reply to patch 10/24.

Thanks,

Michael

> Signed-off-by: Alejandro Colomar <colomar.6.4.3@...il.com>
> ---
>  man2/stat.2 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/man2/stat.2 b/man2/stat.2
> index b35e3c615..3418e1b5d 100644
> --- a/man2/stat.2
> +++ b/man2/stat.2
> @@ -664,8 +664,8 @@ main(int argc, char *argv[])
>          exit(EXIT_FAILURE);
>      }
>  
> -    printf("ID of containing device:  [%lx,%lx]\en",
> -	    (long) major(sb.st_dev), (long) minor(sb.st_dev));
> +    printf("ID of containing device:  [%x,%x]\en",
> +	    major(sb.st_dev), minor(sb.st_dev));
>  
>      printf("File type:                ");
>  
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ