if (start_bit == 0) {
if (num_bits < 7) return key[0] >> (8 - num_bits);
if (num_bits == 8) return key[0];
- if (num_bits == 16) return (key[0] << 8) | key[1];
- return ((key[0] << 8) | key[1]) >> (16 - num_bits);
+
+ chunk = (key[0] << 8) | key[1];
+ if (num_bits < 16) chunk >>= (16 - num_bits);
+ fr_cond_assert(chunk < (1 << num_bits));
+ return chunk;
}
/*
fr_trie_node_t *node = (fr_trie_node_t *) trie;
chunk = get_chunk(key, start_bit, node->bits);
- /* coverity[tainted_data] */
if (!node->trie[chunk]) {
MPRINT2("no match for node chunk %02x at %d\n", chunk, __LINE__);
return NULL;
* No existing trie, create a brand new trie from
* the key.
*/
- /* coverity[tainted_data] */
if (!node->trie[chunk]) {
node->trie[chunk] = trie_key_alloc(ctx, key, start_bit + node->bits, end_bit, data);
if (!node->trie[chunk]) {
void *data;
chunk = get_chunk(key, start_bit, node->bits);
- /* coverity[tainted_data] */
if (!node->trie[chunk]) return NULL;
data = trie_key_remove(ctx, &node->trie[chunk], key, start_bit + node->bits, end_bit);