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>] [day] [month] [year] [list]
Message-ID: <4B16B32D.9030106@nortel.com>
Date:	Wed, 02 Dec 2009 12:34:21 -0600
From:	"Chris Friesen" <cfriesen@...tel.com>
To:	LKML <linux-kernel@...r.kernel.org>
Subject: question on type conversions in show_map_vma()


Another developer and I were looking at show_map_vma() and started
wondering about the "pgoff" value:

pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;

Here we take a variable of type "unsigned long", we cast it to "long
long", shift it, then assign the result to a variable of type "unsigned
long long".

I realize that there isn't any danger of invalid sign extension, but it
does seem a bit odd to be casting to a signed value when the result is
going to be unsigned.

Is there a historical reason why pgoff is unsigned rather than just of
type "loff_t"?

Chris
--
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