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]
Date:	Thu, 23 Oct 2008 13:40:05 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	johannes@...solutions.net
Cc:	adobriyan@...il.com, linux-kernel@...r.kernel.org
Subject: Re: How do I printk <type> correctly?

From: Johannes Berg <johannes@...solutions.net>
Date: Thu, 23 Oct 2008 17:13:26 +0200

> > u64 SHOULD be printed with %llu/%llx, (unsigned long long):
> > 
> > 	printk("%llu", (unsigned long long)u64_var);
> > 
> > s64 SHOULD be printed with %lld/%llx, (long long):
> > 
> > 	printk("%lld", (long long)s64_var);
> 
> out of curiosity, why are there platforms that use an "unsigned long"
> for u64?

Because that type is large enough.

> An "unsigned long long" is 64-bits too even on 64-bit platforms, so
> why the difference? Are there any differences like alignment on some
> platforms?

I invite you to go make that change and then try to fixup all the
resulting build warnings.  Some of us already made an attempt at
some point in the past. :-/

But it's just papering over the core problem, that we can't extend
gcc's automatic printf format type checking easily.

Even if we make u64 the same type everywhere, things like sector_t
and other types which do have to vary by architecture will need
to be casted.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ