]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
isdn: isdnloop: fix pointer dereference bug
authorArnd Bergmann <arnd@arndb.de>
Thu, 7 Mar 2019 09:32:07 +0000 (10:32 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Mar 2019 17:25:52 +0000 (09:25 -0800)
clang has spotted an ancient code bug and warns about it with:

drivers/isdn/isdnloop/isdnloop.c:573:12: error: address of array 'card->rcard' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

This is an array of pointers, so we should check if a specific
pointer exists in the array before using it, not whether the
array itself exists.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/isdnloop/isdnloop.c

index f4253d468ae18a97e58385615029341d839a5d4e..755c6bbc955396ef239cfecc7c780b528dc9a19c 100644 (file)
@@ -570,7 +570,7 @@ isdnloop_atimeout(isdnloop_card *card, int ch)
        char buf[60];
 
        spin_lock_irqsave(&card->isdnloop_lock, flags);
-       if (card->rcard) {
+       if (card->rcard[ch]) {
                isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1);
                card->rcard[ch]->rcard[card->rch[ch]] = NULL;
                card->rcard[ch] = NULL;