]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tipc: eliminate KASAN warning
authorJon Maloy <jon.maloy@ericsson.com>
Wed, 25 Oct 2017 14:19:52 +0000 (16:19 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Oct 2017 00:38:34 +0000 (09:38 +0900)
The following warning was reported by syzbot on Oct 24. 2017:
KASAN: slab-out-of-bounds Read in tipc_nametbl_lookup_dst_nodes

This is a harmless bug, but we still want to get rid of the warning,
so we swap the two conditions in question.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/name_table.c

index 2856e19e036e7a5c96adf4371fb84d9fc0055438..b3829bcf63c76224eb7d19de41293d397912dcbd 100644 (file)
@@ -697,7 +697,7 @@ void tipc_nametbl_lookup_dst_nodes(struct net *net, u32 type, u32 lower,
        spin_lock_bh(&seq->lock);
        sseq = seq->sseqs + nameseq_locate_subseq(seq, lower);
        stop = seq->sseqs + seq->first_free;
-       for (; sseq->lower <= upper && sseq != stop; sseq++) {
+       for (; sseq != stop && sseq->lower <= upper; sseq++) {
                info = sseq->info;
                list_for_each_entry(publ, &info->zone_list, zone_list) {
                        if (tipc_in_scope(domain, publ->node))