Re: [PATCH 1/1] Work around architectures having statfs.f_type defined as long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 19 March 2014, Jes.Sorensen@xxxxxxxxxx wrote:
> @@ -1946,9 +1946,13 @@ int in_initrd(void)
>  {
>         /* This is based on similar function in systemd. */
>         struct statfs s;
> +       /* statfs.f_type is signed long on s390x and MIPS, causing all
> +          sorts of sign extension problems with RAMFS_MAGIC being
> +          defined as 0x858458f6 */
>         return  statfs("/", &s) >= 0 &&
>                 ((unsigned long)s.f_type == TMPFS_MAGIC ||
> -                (unsigned long)s.f_type == RAMFS_MAGIC);
> +                ((unsigned long)s.f_type & 0xFFFFFFFFUL) ==
> +                ((unsigned long)RAMFS_MAGIC & 0xFFFFFFFFUL));

The comment is wrong: on s390x the type is actually 'unsigned int'.
The fix however works on all variants as far as I can tell.

Thinking about it a bit more, I guess we can also cast both
sides to 'unsigned int' for the same effect and get rid of
the mask.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux