]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
radiotap: Avoid ubsan warning on 1<<31
authorJouni Malinen <j@w1.fi>
Tue, 7 Jul 2015 12:39:08 +0000 (15:39 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 7 Jul 2015 13:25:06 +0000 (16:25 +0300)
Use the BIT() macro and unsigned int to avoid ubsan warning on 1<<31 not
fitting in an int.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/utils/radiotap.c

index f8f815a86be923531244232c85d025a08b2c2ae4..c9a5023355922939ccf5c8d0723dbbcf06f9d402 100644 (file)
@@ -123,13 +123,13 @@ int ieee80211_radiotap_iterator_init(
 
        /* find payload start allowing for extended bitmap(s) */
 
-       if (iterator->_bitmap_shifter & (1<<IEEE80211_RADIOTAP_EXT)) {
+       if (iterator->_bitmap_shifter & BIT(IEEE80211_RADIOTAP_EXT)) {
                if ((unsigned long)iterator->_arg -
                    (unsigned long)iterator->_rtheader + sizeof(uint32_t) >
                    (unsigned long)iterator->_max_length)
                        return -EINVAL;
                while (get_unaligned_le32(iterator->_arg) &
-                                       (1 << IEEE80211_RADIOTAP_EXT)) {
+                      BIT(IEEE80211_RADIOTAP_EXT)) {
                        iterator->_arg += sizeof(uint32_t);
 
                        /*