]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/vas: Fix potential NULL pointer dereference
authorGustavo A. R. Silva <gustavoars@kernel.org>
Fri, 15 Oct 2021 05:03:45 +0000 (00:03 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 22 Oct 2021 04:22:04 +0000 (15:22 +1100)
commitec536011704f08f0a29606a27a2928ef0ed8e6f8
tree387e0edd1c52d89addbcf8bb580b476e3b4f1793
parent0cfebd25ae4c9d41756ad3c72e75056a0e89b8b9
powerpc/vas: Fix potential NULL pointer dereference

(!ptr && !ptr->foo) strikes again. :)

The expression (!ptr && !ptr->foo) is bogus and in case ptr is NULL,
it leads to a NULL pointer dereference: ptr->foo.

Fix this by converting && to ||

This issue was detected with the help of Coccinelle, and audited and
fixed manually.

Fixes: ab8003f26f81 ("powerpc/vas: Add platform specific user window operations")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211015050345.GA1161918@embeddedor
arch/powerpc/platforms/book3s/vas-api.c