]> git.baikalelectronics.ru Git - kernel.git/commit
IB/uverbs: Fix an potential error pointer dereference
authorXiang Yang <xiangyang3@huawei.com>
Fri, 4 Aug 2023 02:25:25 +0000 (10:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:53 +0000 (09:42 +0200)
commitd020963638f2b918f72290afe1e4259bbdf0c2af
tree1686a9277c2ec10cd21ca924951f3887524b4eb0
parent4dca13c30b9e7e7c426d8aa2f481ebf6f20cf872
IB/uverbs: Fix an potential error pointer dereference

[ Upstream commit 26b7d1a27167e7adf75b150755e05d2bc123ce55 ]

smatch reports the warning below:
drivers/infiniband/core/uverbs_std_types_counters.c:110
ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ() error: 'uattr'
dereferencing possible ERR_PTR()

The return value of uattr maybe ERR_PTR(-ENOENT), fix this by checking
the value of uattr before using it.

Fixes: ebb6796bd397 ("IB/uverbs: Add read counters support")
Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
Link: https://lore.kernel.org/r/20230804022525.1916766-1-xiangyang3@huawei.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/uverbs_std_types_counters.c