From: Arnd Bergmann Date: Thu, 7 Mar 2019 09:32:07 +0000 (+0100) Subject: isdn: isdnloop: fix pointer dereference bug X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8a72b81e6df516847848556d0967aefa5457f11f;p=linux.git isdn: isdnloop: fix pointer dereference bug 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 Reviewed-by: Nathan Chancellor Signed-off-by: David S. Miller --- diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index f4253d468ae18..755c6bbc95539 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c @@ -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;