Casting 0 to a __bitwise type

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

 



I'm given to understand that bitwise types consider 0 'special', in that
 sparse will allow, say:
        typedef __u32 __bitwise __be32;
        __be32 value = 0;
However, it appears that if I try to cast a constant 0 to a bitwise type,
        static inline void ip6_fill_mask(__be32 *mask)
        {
                mask[0] = mask[1] = mask[2] = mask[3] = ~(__be32)0;
        }
sparse complains "warning: cast to restricted __be32".
Why is this?  Is there some subtle reason why the cast is incorrect, or
 is sparse just unable to notice that the value being cast is 0?
It allows it if I rewrite it with a local variable, making the cast
 implicit:
        static inline void ip6_fill_mask(__be32 *mask)
        {
                __be32 nothing = 0;

                mask[0] = mask[1] = mask[2] = mask[3] = ~nothing;
        }

-Ed
The information contained in this message is confidential and is intended for the addressee(s) only. If you have received this message in error, please notify the sender immediately and delete the message. Unless you are an addressee (or authorized to receive for an addressee), you may not use, copy or disclose to anyone this message or any information contained in this message. The unauthorized use, disclosure, copying or alteration of this message is strictly prohibited.
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux