batman-adv: Annotate bitwise integer pointer casts
The sparse commit 6002ded74587 ("add a flag to warn on casts to/from bitwise pointers") introduced a check for non-direct casts from/to restricted datatypes (when -Wbitwise-pointer is enabled). This triggered various warnings in batman-adv when some (already big endian) buffer content was casted to/from the corresponding big endian integer data types. But these were correct and can therefore be marked with __force to signalize sparse an intended cast from/to a bitwise type. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
This commit is contained in:

committed by
Simon Wunderlich

parent
2b1aa5a4c6
commit
61a292860d
@@ -844,7 +844,7 @@ static bool batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr,
|
||||
|
||||
/* handle as ANNOUNCE frame */
|
||||
backbone_gw->lasttime = jiffies;
|
||||
crc = ntohs(*((__be16 *)(&an_addr[4])));
|
||||
crc = ntohs(*((__force __be16 *)(&an_addr[4])));
|
||||
|
||||
batadv_dbg(BATADV_DBG_BLA, bat_priv,
|
||||
"%s(): ANNOUNCE vid %d (sent by %pM)... CRC = %#.4x\n",
|
||||
|
Reference in New Issue
Block a user